Table of Contents Previous Section

Making Assignments

The basic syntax for making assignments in WebScript is straightforward:

myVar = aValue;

The value you assign to a variable can be either a constant or another variable. For example:

// assign another variable to a variable
myVar = anotherVar;      
// assign a string constant to a variable
myString = @"This is my string.";

The syntax myString = @"This is my string"; is a way of creating instances of the class NSString. For more discussion of this syntax, see the section "Creating Constant NSStrings, NSArrays, and NSDictionaries."

WebScript only supports one data type: objects (ids). However, if you assign a literal integer or floating point value to a variable:

id myInt = 167;

WebScript represents it as an NSNumber object. In this sense WebScript can be said to support integers and floats.

Table of Contents Next Section