Tsallaka zuwa abun ciki
Justice Tech School

if and else

Conditions must be bool. No truthy values.

Example
var n = 15;
if (n % 15 == 0) {
  print("FizzBuzz");
} else if (n % 3 == 0) {
  print("Fizz");
} else {
  print(n);
}

Exercise

Else branch.

if (x) {}  {}

Quiz Test

Can an int be a condition?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.