Question | Click to View Answer |
What does the following code print? var number = {val x = 2 * 2; x + 40}
println(number)
|
|
What does the following code print? var ttt = {
var first = "katy"
s"$first perry"
}
println(ttt)
|
|
What does the following code print? var source = "hotline"
var badSong = {
s"$source bling"
}
println(badSong)
|
|
What does the following code print? var band = {
var name = "sublime"
name
}
println(name)
|
This code raises an error. Variables defined within an expression are local to the expression and cannot be accessed outside the expression. |
What does the following code print? if (10 > 2) { println("ten is greater than two") }
|
This code prints |
What does the following code print? if (10 > 2) println("ten is greater than two")
|
This code prints |
What does the following code print? if (5 != 5) println("not equal") else println("they're equal!")
|
|
What does the following code print? if (true) {
"it is true"
} else {
"i'm confused"
}
|
|