Sedangkan loop php
<?php
$a = 0;
while($a<=5){
echo $a."<br>";
$a++;
}
?>
SISO
<?php
$a = 0;
while($a<=5){
echo $a."<br>";
$a++;
}
?>
var i=0;
while (i < 10) {
console.log(i);
i++;
}
//Alternatively, You could break out of a loop like so:
var i=0;
while(true){
i++;
if(i===3){
break;
}
}
while (condition) {
// code
}
// example
let index = 0;
while (index < 10) {
// code
index++;
}
// enjoy :)
var arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
// while loop
let j= 0;
while(j < arr.length)
{
console.log(arr[j]);
j++;
}
//do-while loop
let k=0;
do{
console.log(arr[k]);
k++;
}
while(k < arr.length);
do {
//whatever
} while (conditional);
let count = 0;
let max = 10;
while (count < max) {
console.log(count)
count = count + 1
}