0
Does while loop can use as if else statement?
when i use while loop i have found that it is like the if statement
3 Answers
+ 2
It may be possible in some cases, but the meaning of while is different:
if/else tells a piece of code to run *once* (if condition true).
while tells code to run *multiple times* (as long as condition true).
+ 1
Yes, you can use it like an if statement, but not an else statement, also it's unnecessary.