+ 1
Can we write if else statements in for loop??
To make source code easy.
4 Answers
+ 6
int x = 0;
for(;;){
if(x%2==0){System.out.println(x+" is even");}
else{System.out.println(x+" is odd");}
x++;}
+ 5
piyush damor your welcome đđ
+ 4
yes, of course you can. you can write else statements any time it follows an if statement
+ 2
Tysm D_stark to elaborate it