How to write an IF statement for executing some code if "i" is NOT equal to 2?
Select one
O A. if (i <> 2)
O B. if i <> 2
O C. if (i != 2)
O D. if i = 2 then
Answers
Answered by
3
Answer:
tutorial on logic and if statements.
We often want to be able to "conditionally" do things in our programs - we want to be able to say "if this thing is true, then do X but if this other thing is true, then do Y." It's like when we wake up in the morning - "if it's raining outside, then I take an umbrella, but if it's sunny, I wear sunglasses." We can do things conditionally in our programs using if statements and if/else statements combined with conditional expressions.
An if statement tells the program to execute a block of code, if a condition is true. In the code below, we output a message only if x is greater than 0:
Explanation:
plss follow me
Similar questions
Math,
3 months ago
India Languages,
3 months ago
Computer Science,
3 months ago
India Languages,
6 months ago
Math,
6 months ago
Math,
10 months ago
Math,
10 months ago