Language documentation Contents | Index

if, Control structures


Prototype:
if (expr)
    statement

Description:
The if construct is one of the most important features of Concept. It allows for conditional execution of code fragments.

If expr is evaluated to true (if is number, has a non-0 value, if a string, is not an empty string, if an array, it contains at least one element, or if is a class or delegate).

Often you'd want to have more than one statement to be executed conditionally. Of course, there's no need to wrap each statement with an if clause. Instead, you can group several statements into a statement group.
If statements can be nested indefinitely within other if statements, which provides you with complete flexibility for conditional execution of the various parts of your program.

Example:
if (a>b)
	echo "a is bigger than b";

// or

if (a>b) {
	echo "a is bigger than b";
	b=a;
}



Documented by Eduard Suica, generation time: Sun Jan 27 18:15:22 2013 GMT(c)2013 Devronium Applications