Rockwell-automation 2098-IPD-xxx Ultra5000 C Programming using the Mot Manual de usuario Pagina 35

  • Descarga
  • Añadir a mis manuales
  • Imprimir
  • Pagina
    / 114
  • Tabla de contenidos
  • MARCADORES
  • Valorado. / 5. Basado en revisión del cliente
Vista de pagina 34
Publication 2098-PM001E-EN-P — July 2002
Programming Motion Control in C 1-23
Control Flow
In this section you will learn about the functions that control the flow
of a C program. The functions include:
Statements and Blocks
If-Else
Else-If
Switch
While, For and Do-While Loops
Break and Continue
Statements and Blocks
A statement is a command to the computer. In C, any expression
followed by a semicolon forms a statement. A statement may or may
not do something. For example the statement,
long point;
declares the variable point, but the null statement (a semicolon by
itself)
;
does nothing.
A block is two or more statements grouped together by enclosing
them in braces. The braces cause the entire block to be evaluated as a
single statement. Without the braces, each statement terminating with
a semicolon is evaluated separately. Refer to the following two
grouping examples.
Example 8 - Grouping Statements
/* grouping example A - individual statements */
point = 0;
while (point++ < 12)
target = 10 * point + 2;
MoveAbsolute(target);
/* grouping example B - blocked statements */
point = 0;
while (point++ < 12)
{
target = 10 * point + 2;
MoveAbsolute(target);
}
Vista de pagina 34
1 2 ... 30 31 32 33 34 35 36 37 38 39 40 ... 113 114

Comentarios a estos manuales

Sin comentarios