Correct usage of the <code>use</code> method

Report a typo

Look at the examples with the use method:

a)

Scanner(File("file.txt")).use {
    val number = it.nextInt()
    println(number * 100)
}

b)

Scanner(File("file.txt")).use { this ->
    val number = this.nextInt()
    println(number * 100)
}

c)

Scanner(File("file.txt")).use { scanner ->
    val number = scanner.nextInt()
    println(number * 100)
}

d)

Scanner(File("file.txt")).use { sc ->
    val number = sc.nextInt()
    println(number * 100)
}

Select all the correct uses of the use method.

Select one or more options from the list
___

Create a free account to access the full topic