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

While Loops in PHP Forum

View Course » View Exercise

1157 points
1fd1601a6654f4f1164c8bc7b19f2358?s=140&d=retro
Submitted by
Bryan
about 2 years ago

1.4: Why will this not work?

Code:

<?php

while(1 < 2) :
echo "1 is smaller than 2.";
endwhile;

?>

My code worked with while syntax, but not with endwhile syntax. Why?


0 votes

permalink

i think it might be because you are missing several things
like for example let me write your code the way i understand it :

$x=1
while($x < 2) :

echo "$x is smaller than 2";

endwhile;

i think.

try doing some research as to why the code wouldn't work . ..

278 points
D74f3e8f6ac51c03fee857f664b33d34?s=140&d=retro
Submitted by
sofiabeans27
about 2 years ago