This forum is now read-only. Please use our new forums! Go to forums

banner
Close banner
0 points
Submitted by Gevin Brown
over 10 years

I receive an error message saying that my loop doesn't echo 20

Answer 52af86757c82ca1f80000306

0 votes

Permalink

Did you get any output? Your counter starts at zero, so the first echo would be 0. Counter then becomes 10, this is less than 11, so the second echo is 10 Counter then becomes 20, which is not less than 11, so program stops

points
Submitted by psedler
over 10 years

2 comments

Gevin Brown over 10 years

No, I didn’t get any output. I don’t understand why the code isn’t working, I was told to do this when I looked at the hint. Should I make the variable less than 100?

Vera Verhoeven over 10 years

for ($leap = 10; $leap <= 100; $leap = $leap+10 ){ echo “

$leap

“; }

Answer 52b0a0db80ff3317a0003135

0 votes

Permalink

First, on the little screen to the right of the coding area – make that full size to see if you’ve an answer. If the answer is correct, it is codeacademy’s answer checker that is at fault Anyway, change $i < 11 to $i < 101. Check the full-size editor screen to see if you’ve now the correct answer. If so, change echo $i** to **echo “

{$i}

“; This format hasn’t been talked about, much, but it worked for me

points
Submitted by psedler
over 10 years

1 comments

psedler over 10 years

that should be echo “

{$i}

“;

Answer 52b305a8548c35d83e001f8e

0 votes

Permalink

Vera’s code is correct. Also, if you are using Google Chrome, try another browser. I used Firefox and the same code on Chrome that did not work, passed on Firefox.

points
Submitted by Goer Tan
over 10 years