Control flow in bean shell scripting

If conditions in Bean Shell

y=2;
x=7;
if(y<x){
print(x);
}

for loop in Bean Shell.

for(i=0;i<5;i++){
print(i);}

Similarly we can have a while loop in BeanShell

j=5;
while(j<10){
print(j);
j++;}