UserTalk generally supports the same operators as most modern programming languages, plus a few extras. To accomodate a variety of preferences, Frontier has word equivalents for many of the symbols. For example, many script writers may prefer "equals" rather than "==" which is easily confused with the "=" assignment operator.if x equals 10
x = 0UserTalk also supports the extended Macintosh character set where appropriate, e.g. "≠" and "≤" are probably easier to read than "!=" and "<=".
Table 4-2. UserTalk Operators
Operator Purpose ----------- ------------------------------------------------------ = Assignment + Add numeric values or concatenate (join) string and character values - Subtract numeric values or remove the first occurance of one string from another * Multiplication / Division (integer or real, depending on the datatypes) % Modulus (remainder of integer division) == equals Test for equality != ≠ notEquals Test for inequality < lessThan Less-than comparison <= ≤ Less-than-or-equal comparison >greaterThan Greater-than comparison ≥ >= Greater-than-or-equal comparison beginsWith Compare one string to the beginning of another contains Determine whether one string contains another endsWith Compare one string to the end of another || or Logical OR && and Logical AND ! not Logical NOT ++ Increment -- Decrement @ Address-of ^ Dereference an address --------------------------------------------------------------------Although they aren't operators, there are a few other characters that have a particular meaning in UserTalk.Table 4-3. Other Special Characters
Character Purpose ----------- ------------------------------------------------------ "..." Define a string (with straight quotes) The string may include curly quotes. To include a straight quote, precede with a backslash. ³...² Define a string (with curly quote) The string may include straight quotes. To include a curly quote, precede with a backslash. (Type curly quotes with option-[ and option-shift-[.) '...' Define a character or "string4" (with single quotes) To include a single quote, precede with a backslash. [...] Evaluate a variable or expression. Also used for lists, records and the object model. ["..."] Include an object database name that contains spaces or other reserved punctuation. \ Treat the next character as a literal. (e.g. to include a quote in a quoted string) \t Tab character (in a quoted string) \r Return (cr) character (in a quoted string) \n Linefeed (lf) or "newline" character (in a quoted string) --------------------------------------------------------------------
UserTalk is a rich language that is capable of dealing with 28 different types of data. Many of these datatypes are useful only to advanced script writers. (All datatypes are listed in DocServer.) The primary datatypes are summarized below. Note that characters and strings support the full Macintosh character set (255 characters).Contents Page | Previous Section | Next Chapter -- Scripting Other ApplicationsTable 4-4. Common UserTalk Datatypes
Datatype Range of Legal Values ----------- ----------------------------------------------------- addressType Any Object Database cell or any non-existent cell in an existing table booleanType True or 1, False or 0 charType Any character, enclosed in single quotes dateType Any legal system date value directionType up, down, left, right, flatup, flatdown, nodirection intType -32768 to 32767 longType -2147483648 to 2147483647 menubarType Any Frontier menubar object outlineType Any Frontier outline object scriptType Any legal UserTalk script stringType One or more characters, enclosed in double quotes string4Type Exactly four characters, enclosed in single quotes Used by the MacOS in several ways tableType Any Frontier Object Database table wptextType Any Frontier word processing text object --------------------------------------------------------------------