Your First While Loop PHP (Codeacademy)

Your First While Loop PHP (Codeacademy)

Here is a correct example:

1
2
3
4
5
6
7
8
9
<?php
	//Add while loop below
    $number = 3;
    while ($number < 10)
        {
            echo $number;
            $number++;
        }
    ?>

The syntax is quite easy to remember. Also, you need to do a simulation in your mind of what the while loop will do or you could cause an infite loop.
If you get an infinite loop and nothing happens on the screen, refresh the codeacademy page.

Add a comment: