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

Control Flow: Switch Forum

View Course » View Exercise

193 points
5651703fe39efe9f4500043c_552013508
Submitted by
pzzrudlf
over 3 years ago

hello, anybody could help me?

my codes are as follows.
<?php
$myage=9;
$yourage=8;
if($myage<$yourage){echo"You're older.";}
esleif ($myage>$yourage){echo"I'm older.";}
esle {echo"The same age!";}
?>

but it shows that "Parse error: syntax error, unexpected '{' on line 5."
i have no idea about it.


1 vote

permalink

First - not ESLE, but ELSE. The same about ELSEIF.

Corrected:

<?php
$myage= 9;
$yourage= 8;
if ($myage < $yourage) {
    echo "You're older!";
} elseif ($myage > $yourage) {
    echo "I'm older!";
} else {
    echo "The same age";
}

?>

377 points
530a0d7b8c1ccc27b200261c_173760816
Submitted by
Kacper Kaczmarek
over 3 years ago


0 votes

permalink

Your "else"&"elseif" write "esle"&"esleif".

That‘s Misspell.

41 points
9b0a411fa2e76082d8388c3ab17980c3?s=140&d=retro
Submitted by
ルリ星野
over 3 years ago