Important MCQ

Which is the correct syntax?

Q.Which is the correct syntax?

A) if (x > 5) { }
B) if [x > 5] { }
C) if x > 5 then { }
D) if x > 5 { }
Correct Answer:
Option A
Detailed Explanation:
A) if (x > 5) { } is correct. An if statement executes its body only when its condition is true. The condition is written in parentheses, and braces group multiple statements.