Introduction to Scala
David Venturi
Curriculum Manager, DataCamp

What do functions do?
What are the parts of a function?
What do functions do?
What are the parts of a function?

scala> 20 > 21
false



scala> 20 > 21

scala> hand > 21

// Define a function to determine if hand busts
def bust(hand: Int): Boolean = {
hand > 21
}
= in curly braces {}
// Define a function to determine if hand busts
def bust(hand: Int) = {
hand > 21
}
= in curly braces {}// Define a function to determine if hand busts def bust(hand: Int) = { hand > 21 }println(bust(20)) println(bust(22))
false
true

println(bust(kingSpades + tenHearts))
false
Introduction to Scala