Display screen says parse error but the lesson when i hit submit said i did it right?


#1


7 All on your own


Parse error: syntax error, unexpected ':', expecting ';' on line 14 from the display screen


<?php
        //write your do-while loop below
         $k = 1;
        do {
            echo "<p>$k</p>";
        }
        while ($k < 10):
            echo "<p>$k</p>";
            $k ++;
        endwhile;
    ?>


#2

do...while loop syntax:

do {
    code to be executed;
} while (condition);

and

while Loop syntax:

while (condition) {
    code to be executed;
}

and you can write like

while (condition):
    code to be executed;
endwhile;

so in your code you didn't complete your do...while loop.

make sense :slight_smile:


#3

Ohhh, wow thank you. I need to watch more carefully. Much appreciated. :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.