Skip to content

01 Scala Principles 01 Session 03 Functions Exercise

Tai Truong edited this page Feb 3, 2014 · 1 revision

In this small exercise you will extend functions and use extensively if-else expressions.

If-Else-Expressions

Scala's if-else expression is similar to Java's condition expresion: "condition ? if-value : else-value"

Calculator: Signum

Extend the calculator with a signum operator

Boolean inverter

Use if-else to convert a boolean input

Boolean operations

Use if-else to implement these boolean operations: and, or, negate

Resources

if-else expression