Table of Contents Previous Section
This section summarizes the WebScript language.
WebScript includes the following reserved words:
if else for while id break continue nil YES/NO
WebScript supports the following statements:
if else for while break continue return
In WebScript these statements behave as they do in the C language.
WebScript supports the arithmetic operators +, - , /, *, and %. The rules of precedence in WebScript are the same as those for the C language. You can use these operators in compound statements such as:
b = (1.0 + 3.23546) + (((1.0 * 2.3445) + 0.45 + 0.65) - 3.2);
WebScript supports the negation (!), AND (&&), and OR (||) logical operators. You can use these operators as you would in the C language, for example:
if ( !(!a || a && !i) || (a && b) && (c || !a && (b+3)) ) i = 0;
WebScript supports the relational operators <, <=, >, >=, ==, and !=. In WebScript these operators behave as they do in C.
WebScript supports the ++ and -- operators. These operators behave as they do in the C language, for example:
// Use myVar as the value of the expression and then increment myVar myVar++; // Increment myVar and then use its value as the value of the expression ++myVar;
WebScript supports only one data type: objects (ids). The id type is defined as a pointer to an object---in reality, a pointer to the object's data (its instance variables). Like a C function or an array, an object is identified by its address. All objects, regardless of their instance variables or methods, are of type id.
In WebScript, self is available in every method. It is a "hidden" variable that refers to the object (the WOApplication object, the WOSession object, or the WOComponent object) associated with a script. When you send a message to self, you're telling the object associated with the script to perform a method that's implemented in the script.
As with self, super is a "hidden" variable available in every method. By sending a message to super, you are invoking the superclass' implementation of the method. An invocation of super's init method should occur at the beginning of an init implementation.