1 1 4 Enunciados de control Apoyo SSD3
Control and Selection By default, statements in a program are executed sequentially in the order that they appear.  Programming languages provide control structures to alter this default.  Selection is used to conditionally prevent the execution of a statement.
If-Else The general selection structure in Java is the if-else-statement. It has the following form. if (condition)  { statements1 } else { statements2 }
Operator ?: There is an operator that is often confused with the if-else-statement, the conditional operator ("?:"). Below is an indication of its use. variable = condition ? exp1 : exp2;
Operator ?: If  condition  is true,  variable  is assigned the value of  exp1 ; otherwise  variable  is assigned the value of  exp2
Switch There is one other selection construct available in Java, the switch-statement. It has the following form. switch (expresión entera)  { case  cie1: statements1 case  cie2: statements2 ... case  cien: statementsn default: statementsd }
For The for-loop has the following form. for (initialization; condition; update) { statement } The statement, of course, can be a compound statement.  Notice that the semicolons are separators, not terminators.
When a for-loop is encountered, the initialization occurs just once and foremost.  Then, the condition is evaluated. If the condition evaluates to true, the body is executed, followed by the update.
Then, the condition is retested, and the cycle continues. When the condition becomes false, the loop is exited. If the condition never becomes false, an infinite-loop occurs. This is generally undesirable
While The while-loop has the following form. initialization while (condition){ body update } Since the update typically appears in the body of the while loop, the while loop often uses a compound statement.
Do-While The do-while loop has the following form. initialization do  { body update }  while (condition); The do-while loop is similar in structure to a while-loop, except in its upside-down appearance, as the condition appears after the body.

1 1 4 Enunciados De Control

  • 1.
    1 1 4Enunciados de control Apoyo SSD3
  • 2.
    Control and SelectionBy default, statements in a program are executed sequentially in the order that they appear. Programming languages provide control structures to alter this default. Selection is used to conditionally prevent the execution of a statement.
  • 3.
    If-Else The generalselection structure in Java is the if-else-statement. It has the following form. if (condition) { statements1 } else { statements2 }
  • 4.
    Operator ?: Thereis an operator that is often confused with the if-else-statement, the conditional operator ("?:"). Below is an indication of its use. variable = condition ? exp1 : exp2;
  • 5.
    Operator ?: If condition  is true,  variable  is assigned the value of  exp1 ; otherwise  variable  is assigned the value of  exp2
  • 6.
    Switch There isone other selection construct available in Java, the switch-statement. It has the following form. switch (expresión entera) { case cie1: statements1 case cie2: statements2 ... case cien: statementsn default: statementsd }
  • 7.
    For The for-loophas the following form. for (initialization; condition; update) { statement } The statement, of course, can be a compound statement. Notice that the semicolons are separators, not terminators.
  • 8.
    When a for-loopis encountered, the initialization occurs just once and foremost. Then, the condition is evaluated. If the condition evaluates to true, the body is executed, followed by the update.
  • 9.
    Then, the conditionis retested, and the cycle continues. When the condition becomes false, the loop is exited. If the condition never becomes false, an infinite-loop occurs. This is generally undesirable
  • 10.
    While The while-loophas the following form. initialization while (condition){ body update } Since the update typically appears in the body of the while loop, the while loop often uses a compound statement.
  • 11.
    Do-While The do-whileloop has the following form. initialization do { body update } while (condition); The do-while loop is similar in structure to a while-loop, except in its upside-down appearance, as the condition appears after the body.