+ 1
Conditional Statement
Can a āifā statement be use without an āelseā statement?
5 Answers
+ 7
Yes in any language it is possible.
+ 3
It depends on the language. For whichever language you are interested in, the easiest way to get an answer is to just try it. If the compiler or interpreter doesn't complain, it works.
+ 2
Yes, if block statement use without else statement, and why use if-block statement mostly? because if the if-block condition false then it goes to else block statement, otherwise no problem if we use if-block statement without the else statement.
+ 1
Yes, the if statement can be used without āelseā because if only executes the indented block of code as long as the condition evaluates fo True, while else only execute if the āifā statement does not evaluate to āTrueā.
- 1
Yes, if only the condition is āTrueā.