while loop
is a very important part of the programming language because of its functionality. In this tutorial, we will examine and compare a while loop for programming languages like Javascript, C, C++, C#, and Python, Go.
C:
while (i < 5){
printf("Value is %d", i);
i++;
}
C++:
while (i < 5){
cout<< i;
i++;
}
Python:
i = 1
while i < 5:
print(i)
i += 1
Java:
while (i < 5){
System.out.println(i);
i++;
}
PHP:
while($a < 5){
echo $a;
$a++;
}
Javascript:
while (i < 5) {
console.log(i);
i++;
}
GO:
for i < 5 {
fmt.Println("i =", i)
i++
}