This forum is now read-only. Please use our new forums at discuss.codecademy.com.

Control Flow: Switch Forum

View Course

307 points
D376f86b4754dd5c9543eeee4109a27b?s=140&d=retro
Submitted by
earningmap
about 2 years ago

What is the error?

I have created the task of Control Flow: Switch 6/6 but I am getting the same error"Oops, try again. Make sure you have three case blocks!"

<?php
$age = 34;
switch ($age){

case 35;
echo "this is 35";
break;

case 32;
echo "this is 32";
break;

case 34;
echo "this is 34";
break;

default;
echo "this is something else";
}
?>


0 votes

permalink

You use semicolon instead of a colon after every case.

 case 0:
            echo 'The value is 0';
            break;

BR
D.

1409 points
588b2ac3e1281365f0000133_918398059
Submitted by
Codmakr
about 2 years ago