Bem-vindo ao JavaScript Tutorial
Previous topic/Tópico anterior
Next topic/Próximo tópico
09 - while looping expressions

Use the while when you want a code block to repeat n times, using a simplier conditional checker.


<html>
<body>

<script>

number = 0

while (number < 10)
{
	number++
}

alert(number)

</script>

</body>
</html>
While the conditional is true, the code block will be executed. Note that inside the block we are executing a code (number++) that will make us exit the loop (making the "number < 10" to be false in the future).

Previous topic/Tópico anterior
Next topic/Próximo tópico
[ Voltar ]


© 2005 JavaScript Tutorial Brasil
Proibida a cópia ou distribuição integral ou parcial não-autorizada
Unauthorized integral or partial distribution or reproduction is forbidden
Patrocínio - Assistência Técnica de Calculadoras HP CSCenter