Question Bank (2 marks) · Q32
Q.Write the syntax of if- else statement.
Karnataka PUCTextbookShort· 2mImportance★★★★★est
94% · 144/154 Questions
You're viewing a preview — the full solution, concept, methods & PYQ mapping are locked.
Start your 14-day free trial to unlock the full solution →[!TLDR]
Syntax: if (condition) { block1; } else { block2; }
The if-else statement tests a condition. If it is true, the first block of statements runs; if it is false, the block following else runs. Exactly one of the two blocks is executed.
if (test condition)
{
statement block 1; /* executed if condition is true */
}
else
{ …
Unlock everything free for 14 days
- Full step-by-step solutions
- Concept-first explanations
- Methods, shortcuts & mistakes
- PYQ mapping + timed mock tests
Full access for 14 days. No credit card required.