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
numis divisible by5. We already have the check for that in line 6. In the providedswitchstatement, the code is checking if the remainder ofnumdivided by5is equal to0. The%symbol is the modulo operator, which returns the remainder of a division ...
Ask