while loop syntax code example
Example 1: while loop
i = 0
while i < 6:
i += 1
if i == 3:
continue
print(i)
Example 2: while loop
var i=1;
while(i<=10){
document.write(i + "<br>");
i++;}
Example 3: while loop
#include<stdio.h>
int main()
{
printf("\n\n\t\tStudytonight - Best place to learn\n\n\n");
int i = 0;
printf("\nPrinting numbers using while loop from 0 to 9\n\n");
while(i<10)
{
printf("%d\n",i);
i++;
}
printf("\n\n\t\t\tCoding is Fun !\n\n\n");
return 0;
}
Example 4: whiel loop in C
while (testExpression)
{
}