H (Hybrid) Language - v0.03, by Dr. Herong Yang
Loop "break" Statement
This section describes what is a loop 'break' statement in H language.
A loop "break" statement is a statement that terminates a loop early before it reaches end of the loop condition.
When a loop "break" statement is executed, the execution will be transferred to the end of the loop immediately.
A loop "break" statement has the following syntax:
loop ( ...; $break; ...; );
Examples of loop "break" statements are:
# the follow code runs a loop to check
# if a given number is a prime number
x = 6789;
isPrime = $true;
i = 2;
$while i < x, (
isPrime = x % i > 0;
$if !isPrime, $break; # stop the loop
);
$if isPrime, write("x is a prime number.");
$else, write("x is not a prime number.");
Table of Contents
Conditional "elseif" Statement
"switch" Statement - Not Supported
"do...while" Statement - Not Supported
Inheritance - Object Attachments