Branching Flashcards

1
Q

if statements,

A

The most basic branching structure is an if structure. This instructs the computer to only execute a set of
instructions if a certain condition is true.

if (condition)
{
…instructions…
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

if-else statements,

A

Branching structures can become more complex by adding an else structure. This follows the if structure
and instructs the computer to execute a set of instructions if the condition is not true. Again, it must
include opening and closing braces {}.

if (condition)
{
…instructions…
}
else
{
…instructions…
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

if-else if-else statements,

A

Branching structures can also include additional conditions as else if sections. This follows the if structure
but precedes the else structure, and instructs the computer to execute a set of instructions if these
additional conditions are true. Each additional condition must include opening and closing braces {}.

if (condition)
{
…instructions…
}
else if (condition)
{
…instructions…
}
else
{
…instructions…
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

nested statements

A

A nested if statement is an if statement placed inside another if statement.

if (condition)
{
if (condition)
{
sfhahiugeigr
}
else eiawgurgauigbaiwbrgj
}

How well did you know this?
1
Not at all
2
3
4
5
Perfectly