Start learning free

LESSON 48 OF 348 · FUNCTIONS I

Return: Quiz IV in Scala in Scala

Quiz

Quiz: What would this code produce if we were to copy-paste it in a code editor and run it?

def greetAndReturn(): String = {
    return "How are you doing?"
    println("Hey bro!")
}

def mainFunction(): Unit = {
    val question = greetAndReturn()
    println(question)
}

Important Note:

Do not use an actual code editor to get the answer! It would defy the whole purpose of the quiz!

Pick your answer

Next lesson

Quiz Return 7 in Scala

Keep going with ScalaAbout 340 step-by-step lessons, from your first line of code to coding interviews. Free to start.
Start learning free