Very important task

Report a typo

You have a task from your boss: he writes a word to the console, you should read it, create a file, and name it by that word. Then you need to write one string into your file: "I've done it!"

Your boss started writing the function doTask(), but parts of the code are in the wrong order. Please correct it.

Reorder lines using drag or arrows. Adjust indentation with left buttons
                fun doTask(): File {
              
                val name = scanner.next();
              
                return File(name);
              
                it.write("i've done it!")
              
                }
              
                FileWriter(name).use {
              
                val scanner = Scanner(System.`in`)
              
                }
              
___

Create a free account to access the full topic