48.8k views
1 vote
The parentheses around the logical expression of an if statement are optional.

a) True
b) False

User Mina Atia
by
8.6k points

1 Answer

0 votes

Final answer:

The parentheses around the logical expression of an if statement are optional.

Step-by-step explanation:

The correct answer is a) True.

The parentheses around the logical expression of an if statement are indeed optional in programming languages such as C, C++, Java, and Python.

For example, in Java, the if statement can be written with or without parentheses:

  • With parentheses: if (condition) { // code }
  • Without parentheses: if condition { // code }
User Harry He
by
7.8k points

No related questions found

Welcome to QAmmunity.org, where you can ask questions and receive answers from other members of our community.