/* A FizzBuzz assignment with DRY and clean code
Not the fastest nor shortest code, but readable for everyone */
$start = 100;
for ($iteration = 1; $iteration <= $start; $iteration++) {
$endOfLine = "</br>";
$dividableByThree = $iteration % 3 === 0;
$dividableByFive = $iteration % 5 === 0;
if ($dividableByThree && $dividableByFive) {
echo "SupportDesk" . $endOfLine;
} elseif ($dividableByThree) {
echo "Support" . $endOfLine;
} elseif ($dividableByFive) {
echo "Desk" . $endOfLine;
} else {
echo $iteration . $endOfLine;
}
}
Last active
November 17, 2017 19:29
-
-
Save brianveltman/2c2b3faeadf8636ff659d5f93441fd23 to your computer and use it in GitHub Desktop.
simple fizzbuzz
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment