Start learning free

LESSON 35 OF 348 · FUNCTIONS I

Exercise: Create Function in Scala in Scala

Practice

We've wrritten this code:

def mainFunction(): Unit = {
	println("Hello AlgoCademy!")
	println("Coding is amazing!")
	println("Functions are so useful!")

	println("Hello AlgoCademy!")
	println("Coding is amazing!")
	println("Functions are so useful!")

	println("Hello AlgoCademy!")
	println("Coding is amazing!")
	println("Functions are so useful!")
}

Write the same code in a better way by creating and calling a function printMessages()

STEP 1 OF 2
    Ctrl + Enter to check

    Exercise Create Function 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