0

Can the else-part be empty?

Can the else-part be empty?

17th Nov 2016, 10:20 AM
Tomas Zlanabitnig
5 ответов
+ 6
yes, you can leave it empty. But the program will only execute the first statement since the counter statement supposed to be in the else section is not available. it is acailable to not leave it empty so as to have different arguments.
17th Nov 2016, 11:09 AM
David Kariuki
David Kariuki - avatar
+ 4
Yes if you don't need that make it empty or do not create it.
17th Nov 2016, 10:26 AM
Aditya kumar pandey
Aditya kumar pandey - avatar
+ 1
it make the only 'if' statement
28th Nov 2016, 7:40 PM
Ananta Khare
Ananta Khare - avatar
+ 1
when the else part is false or empty then it not execute the else expression output . it make only if statement ....
28th Nov 2016, 7:43 PM
Ananta Khare
Ananta Khare - avatar
0
yes, it can, but then it makes more sense to create/have an if condition without the else part, like: if (condition) { do-something }
29th Dec 2016, 6:51 AM
Tudor