Application Development with Harbour/Control Structures

From Wikibooks, open books for an open world
Jump to: navigation, search

Loops[edit]

WHILE[edit]

[DO] WHILE condition
    ...
    [LOOP]
    [EXIT]
END[DO]

FOR[edit]

FOR var := init_exp TO end_expr [STEP step_expr]
    ...
    [LOOP]
    [EXIT]
NEXT

FOR EACH[edit]

FOR EACH var IN collection_expr
    ...
    [HB_EnumIndex()]
    [LOOP]
    [EXIT]
NEXT

IF[edit]

IF condition
    ...
[ELSEIF condition]
    ...
[ELSE]
    ...
END[IF]

SWITCH[edit]

SWITCH condition
    CASE literal_expr
        ...
        [EXIT]
    [CASE literal_expr]
        ...
        [EXIT]
    [DEFAULT]
        ...
END

BEGIN SEQUENCE[edit]

BEGIN SEQUENCE
    ...
    [BREAK]
    [Break([expression])]
[RECOVER [USING var]]
    ...
END [SEQUENCE]