Home | About SQeeL | Document | DownLoad | Mail Japanese
Home > Document > SQeeL Online Manual >

4. Statement

SQeeL program is basically consists of statements and is constructed with the combination of statements.
There are several types of statements.
Declaration

Declaration defines variables, fixed values, and functions.
Since declaration only defines variables and functions, SQeeL ignores the declaration while executing a program.
* For more information about the scope of variables declared in the declaration, see [3. Syntax - Variable Scope] .

Top
local
global
const
function
arguments
require
exglobal
Control statement

Control statement controls a flow of program operation.
If the statement does not contain any control statement, SQeeL program executes a program from the beginning.
Control statement enables executing a part of a program and executing a certain part of the program repeatedly.
if, else
loop, break, continue
Loops the same process.
Loop statement does not only loop for the number of times specified but also controls the loop process by using continue and break statements.

loop expression1; expression2; expression3
        process
        [continue]
        [break [integer]]
endloop


After the expression1 is determined, the expression 2 is determined next.
If the result is true, execute the process up to the next endloop statement.
If the result is false, jump to the process after endloop statement.
In endloop statement, after the expression 3 in loop statement is determined, the expression 2 in loop statement is determined.
If the result is true, execute the block after loop statement again.
If the result is false, jump to the process after endloop statement.

When continue statement is executed while a process loops between loop and endloop statements, the process jumps to endloop, and then the expression 3 and the expression 2 are determined.
When break statement is executed while a process loops between loop and endloop statements, the process forcefully backs out of the loop, and moves to the statement after endloop statement.
If there are multiple loops between loop and endloop statements, it is possible to back out of the loop for current loop added to the specified integer by specifying 1 or larger integer in break statement.

loop, endloop program
loop i = 1; i <= 10; i++
	if i == 4
		print('continue')
		continue
	endif
	print('Hello World!')
endloop
loop h = 1; h <= 10; h++			// loop a
	print ('loop a:${h}')
	loop i = 1; i <= 10; i++		// loop b
		print ('loop b:${i}')
		loop j = 1; j <= 10; j++	// loop c
			if j == 4
				break 1	// back out of loop a
			endif
			print('loop c:${j}')
		endloop
	endloop
endloop


Top
foreach
goto
on error goto
return
exit
include

© Insight Technology, Inc. 1996-2004 All Rights Reserved.