|   Expressions | ![]() |
ExpressionsExpressions in scripts can contain any of the standard C operators:
Parentheses “(” and “)” can be used to group expressions. For example: (13 + 358) * (12 ^ 3)is a valid expression. The following comparison operators can be used:
For example, (64 > 32)would return the value 1. Any of the assignment operators +=, -=, *=, /=, &=, ^=, %=, |=, <<=, or >>= can also be used.
NumbersNumbers may be entered in 3 formats: octal, hexadecimal, and decimal. See Introduction to Number Systems.
CharactersAs with C, characters are treated internally as numeric constants, and as such can be used in the same types of mathematical operations as any numbers. Characters are single quotes (') that enclose the desired character value. For example, 'A' represents the character A. Escape sequences are the same as in C:
Character quotes can surround entire strings (for example, 'L. Spiro'), however only the first character will be used as the character constant ('L' in this case). Octal sequences are interpreted up to the first non-octal character, and then are cast down to either type char or type short (wchar_t) in the case of Unicode strings. This is in contrast with C, which would have the programmer specify two octal characters to form a single Unicode character (for example, L'\032\040'). Hexadecimal sequences are interpreted up to the first non-hexadecimal character, and then are cast down to either type char or type short (wchar_t) in the case of Unicode strings. This is in contrast with C, which would have the programmer specify two hexadecimal characters to form a single Unicode character (for example, L'\x32\x40'). Create a Unicode character by placing an L in front of it, for example, L'A'.
StringsStrings are exactly the same as in C with the exception of how octal and hexadecimal escape sequences are parsed. As mentioned above, octal and hexadecimal escape sequences are parsed until the first invalid character and then cast down to either char or short (wchar_t). |
Copyright © 2006 Shawn (L. Spiro) Wilcoxen |