Home (Spotlight) | TOC
| Products & Ordering | Technical
Info | Contact Zeus
Zingo Dictionary
Copyright © 1996-1997.
Zeus Productions. All Rights Reserved.
- Miscellaneous
- # (symbol operator)
- [] (list operators)
- -- (comment delimiter)
- (continuation character)
- @ (pathname operator)
- ( ) [parentheses]
- Strings
- & (string concatenation)
- && (string concatenation with space added)
- " (quote used for string constant)
- Comparison
- = (equal sign)
- <> (not equal)
- > (greater than)
- >= (greater than or equal to)
- < (less than)
- <= (less than or equal to)
- Arithmetic
- * (multiplication)
- - (subtraction or negation)
- + (addition)
- / (division)
# (symbols and properties)
syntax: #symbolName
The number sign, or pound sign, (#) indicates a Lingo symbol, including
symbols used as properties in a property list.
Symbols are a convenient for representing constants, such as integers and
strings, and give you the speed and efficiency of integers, but are easier
to understand and remember than "meaningless" integers.
Examples:
set fruit = #Apple -- assignment
if fruit = #Apple then put "Bite Me" -- comparison
eat (#Apple) -- Passing as a parameter
-- Returned as a value from a function:
on getFruit
return #Apple
end
-- Symbols use as properties in a property list
set myPropList = [#Apples: 1, #Bananas:7, #Oranges: 8]
Symbols Names:
- Are case-insensitive (not really true)
- Should start with a letter, not a number (and they should not contain
decimal points)
- Should use only the first 128 ASCII characters
Under Windows 3.1, the number of symbols is limited to 64K, or approximately
5,000 symbols depending on the length of each symbol and other global items.
Symbols are not the same as variables. you can not set a value for a symbol.
(In this way they are different from C language #define statements)
See "Using Lists", property
lists, global, symbolP,
string
Refer to chapter 2 of the Lingo manual - Script basics
[] (list operator)
syntax: [element1, element2, ... elementn]
Lists are used to store multiple pieces of data. Brackets are used to create
a list, such as:
set myList = [1,7,8]
set myPropList = [#Apples: 1, #Bananas:7, #Oranges: 8]
set myEmptyList = []
set myEmptyPropList = [:]
If your keyboard does not have square brackets, you can use the list
function instead.
See "Using Lists", property
lists, list, listP,
"Data Types"
-- (comment delimter)
syntax: -- Your comment here
The comment delimiter (two hypens in a row with no spaces) indicates that
Lingo should ignore the following text. Use comments to explain your Lingo
code.
Director also prints the comment character preceding any output in the Message
window, such as:
put the colorDepth
-- 8
See continuation character
See Lingo programming structure definition
See TechNote, "Using Comments".
continuation character /
The continuation character joins long lines of Lingo together, and can be
used to make your Lingo more readable.
if the memberNum of sprite 1 < the memberNum of
sprite 2 then put "The test is true"
- To create the continuation character, use:
- Macintosh: Option-Return
- Windown: Alt-Enter
Pitfalls:
The continuation character continues lines of comments too!
-- This is a long comment, even though
this line does not have a comment character
it is considered part of the previous line, and is therefor a comment
The Director manauls claim that a line is limited to 256 characters, but
this is not the case.
& (string concatentation operator)
syntax: string1 & string 2
The concatenation operator (&) joins two strings, converting the second
operand to a string if necessary.
put "Hello" & "World"
-- HelloWorld
Precedence level 2.
&& (string concatentation operators
with added space)
syntax: string1 && string 2
The spaced concatenation operator (&&) joins two strings, converting
the second operand to a string if necessary, and adding a space between
them. Use this instead of manually padding a string with a space.
put "Hello" && "World"
-- Hello World
Precedence level 2.
() [parentheses]
syntax: (precedence grouping)
(expression1 + expression2) * expression3
syntax: function parameter call
handlerName()
handlerName(arg1, arg2, ...argn)
Parentheses are used for two distinct purposes:
- To override the order of evaluation of an expression, despite the
default precedence of the operators. The parentheses themselves have a high
precedence level meaning they are evaluated first. You can nest parentheses,
and the innermost pair will be evaluated first.
For example:
put 9 - 2 * 4
--1
put 9 - (2 * 4)
--1
put (9 - 2) * 4
-- 28
put ((9 - 1) / 4) * 5
-- 10
Pitfall:
Parentheses are required when Lingo does not not evaluate an expression
in the order you would like, such as
open window the pathname & "myMovie" -- wrong
open window (the pathname & "myMovie") -- right
Parentheses are also used to surround the parameters being passed to a function
call. They are optional if the function does not return a value, but are
mandatory if the called function returns a value (even if there are no parameters).
on printText myString
put myString
return "hello"
end
put foo
-- <Void>
foo
-- handler not defined error?
put foo ("Testing 1,2,3")
-- Testing 1,2,3
-- hello
foo "Testing 1,2,3"
-- Testing 1,2,3
foo("Testing 1,2,3")
-- "Testing 1,2,3"
put
Pitfall:
Parentheses are required when calling a handler that returns a value. Otherwise
Lingo thinks the handler name is just a variable, and an error results.
put rollover -- wrong (generates an error)
put rollover() -- right
-- 1
- (minus sign)
syntax (subtraction, precedence level 3):
set x = y - z
syntax (negation, precedence level 5):
set x = - y
See Arithmetic Operators for details on precedence
and implicit type conversion.
* (multiplication)
syntax:
set x = 5 * 4
put x
-- 20
Multiply every item in a list by some value
set newList = [1,2,3] * 5
put newList
-- [1,10,15]
Mutiplies two numbers. Precedence Level 4. If either operand is a floating
point number, the result is a float, otherwise, the result is an integer
See Math Operators for Precedence and Type Conversion issues
------
+ See math operators
----
/ (division
expresstion 1 / expression 2
Integer divison - no rounding
floating point dvisions
Precede 4
put 10/3
-- 3
put 10/3.0
-- 3.333
See float precision
========
Comparsision operators
These perform implicit type conversions.
Can compare integers, floats, strings, rects and points.
<> and = also works with symbols and objects?
<
<=
<>
=>
>=
========
" (quote)
Defines a string constant such as
"hello"
See Lingo expanation
Use Quote to include a quote in a string
See QUOTE.
=---------
------
@ pathname operators
- Avoid it - it is a hassle
Use the Linog separator instead - a lot of problems
---
=====
open
pathname
platform
startMovie
startUp
stopMovie
Home (Spotlight) | Table
of Contents | Links | Contact
Info
Place an Order | Products
for Sale | Licensing | Downloads
TechNotes | FAQs
| E-Mail Zeus | GuestBook
| Glossary
Copyright © 1996-1997. Zeus
Productions. All Rights Reserved.
(This page last revised August 25, 1997)