generate functionMon, 02 Jan 2023

create an array containing the colours of the rainbow, then print them in a random order

val colors = arrayOf("Red", "Orange", "Yellow", "Green", "Blue", "Indigo", "Violet") fun main(args: Array<String>) { colors.shuffled().forEach { println(it) } }

Questions about programming?Chat with your personal AI assistant