Control Flashcards
1
Q
What does the ‘if’ statement do?
A
It evaluates a specific condition and if it’s met, executes the branch of code.
2
Q
What is the syntax for a basic if statement?
A
if ( condition )
{
body;
}
3
Q
What is the operator used to compare if two values are equal?
A
The ‘==’ operator
4
Q
What does the ‘!’ operator do?
A
It inverts a value
5
Q
What is the value of ‘x’ after the code is executed?
int x = 9; if (x != 10) { x = 10; }
x += 3;
A
x = 13