Hébergement
Forum
<script type="text/javascript" > if ( 3 < 2 ) { // instructions si le test est vrai document.write("bizarre"); } else { // instructions si le test est faux document.write("3 < 2 est faux"); } </script>donne
<script type="text/javascript" > var i=0; do { document.write(i + " <br>"); i++; } while ( i < 3 ); </script>donne
<script type="text/javascript" > var i=0; while ( i < 3 ) { document.write(i + " <br>"); i++; } </script>donne
<script type="text/javascript" > for (i=-1; i<4 ; i++) { document.write(i + " <br>"); } </script>donne
<script type="text/javascript" > var i = "smc", r; switch(i) { case "smn" : r="salemioche.net"; break; case "smc" : r="salemioche.com"; break; default: r="choix invalide"; } document.write(r); </script>donne
<script type="text/javascript" > for (i=-1; i<5 ; i++) { if ( i == 3 ) continue; document.write(i + " <br>"); } </script>donne
<script type="text/javascript" > for (i=-1; i<5 ; i++) { if ( i == 3 ) break; document.write(i + " <br>"); } </script>donne