+ 1

Why we use if statement?

We use if for selection

2nd Dec 2017, 12:36 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
5 odpowiedzi
+ 4
The if statement allows you to control if a program enters a section of code or not based on whether a given condition is true or false.
2nd Dec 2017, 12:48 PM
Md. Nafis Ul Haque Shifat
Md. Nafis Ul Haque Shifat - avatar
+ 4
Yes the condition must be true if the condition became false then we use else
2nd Dec 2017, 1:06 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 4
syntax if(a==b) { a==0; } else { b==0; }
3rd Dec 2017, 12:08 PM
Puneet Bhardwaj
Puneet Bhardwaj - avatar
+ 2
while running our programs, we try to check certain things and make a decision like if I see watermelons in that store, I will buy two of it
7th Dec 2017, 8:34 PM
Mohamed Gadaphy Nkwenkwat
Mohamed Gadaphy Nkwenkwat - avatar
+ 1
we use if statement for checking any condition eg. if we want to check the number is great than 2 or not then we will use if condition for that like if(num>2) { //your code }
5th Dec 2017, 4:33 PM
Kiran Rathod
Kiran Rathod - avatar