Why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why?

Why do you need to make a false statement in the code if the program just ignores it?

24th Jan 2018, 4:04 PM
Gavyn Davis
Gavyn Davis - avatar
2 Answers
+ 16
sometimes u want to exclude some set of statement(s) , if condition evaluates to false //for example : u want to print odd numbers & also divisible by 3 for (int a=1;a <=n;a++){ if(a%2!=0&&x%3==0) { System.out.println(a); } }
24th Jan 2018, 4:37 PM
Gaurav Agrawal
Gaurav Agrawal - avatar
+ 2
sometimes false statement is all we need
24th Jan 2018, 4:37 PM
fahim