Hi all, I’m trying to create a random generator to...
# getting-started
j
Hi all, I’m trying to create a random generator to generate an element of an Array/List. Found this in the docs:
val forBreakfast = Random.nextInt(until = 3).let { menu[it] }
I get most parts of this code except for what does ‘it’ mean in the square brackets? Is it some placeholder variable to represent the generated number or something?
j
above code is equivalent to
menu[Random.nextInt(until = 3)]
1
j
Ah I see. Thank you!
k
j
This is useful. Thank you for the replies!