Solution: Writing a switch Statement
Review the solution of implementing conditional logic using the switch statement.
We'll cover the following...
Task 1 solution
Here’s a step-by-step solution to complete the missing code in the provided switch
statements:
-
First, we want to check if
num
is divisible by5
. We already have the check for that in line 6. In the providedswitch
statement, the code is checking if the remainder ofnum
divided by5
is equal to0
. The%
symbol is the modulo operator, which returns the remainder of a division operation. So, ...