May 6, 2013

Using While Loop

Coding

<html>
<body>
<script language="JavaScript">
i = 0
while (i <= 5)
{
document.write("The number is " + i)
document.write("<br>")
i++
}
</script>
</body>
</html>

Explanation

i equal to 0.

While i is less than , or equal to, 5, the loop will continue to run.

i will increase by 1 each time the loop runs.

No comments:

Post a Comment

Popular Posts

Views