Home (Spotlight) | TOC
| Products & Ordering | Technical
Info | Contact Zeus

Zingo Dictionary

Expression Evaluation

Copyright © 1996-1997.
Zeus Productions. All Rights Reserved.
### Implicit Type Conversion

Some Lingo operations require that the operands be of a certain type. For
example, you can add two integers, but you can not add and integer and a
string together arithmetically.
### Type Conversion for Numbers

In arithmetic operations, if both operands are integers, the result is an
integer. If one or both of the expressions is a floating point number, the
result is a float as well.

The following arithmetic operations all perform implicit type conversion
on their operands.

+ (addition)

- (subtraction)

- (negation)

* (multiplication)

/ (division)

mod (modulo division (i.e. determine the remainder))

For example:
put 5 * 7
-- 35
put 5 * 7.0
-- 35.0
put 5.0 * 7
-- 35.0
put 5 + 7
-- 12
put 5 - 7.0
-- -2.0
put 5/7
-- 0
put 5.0/7
.707
put 7 mod 5
-- 2
put 5.0 mod 7
-- 5.0

Other mathematical functions

abs (expression)

returns a value that is the same type as the expression, with an integer
or a float.

### Type Conversion for Strings

Many Lingo commands operate on strings. If the initial operand is not a
string, an error may result. Latter operands are often implicity converted
to strings. The & and &&
concatenation operators, implicity convert numbers to strings.

For example:
set x = 7
put "The value of x is:" && x
-- The value of x is 7

### Explicit Type Conversion

You can force type conversions explicitly using the Lingo functions listed
below.

string() - converts value to a string

value() - converts a string to a number, or a
lis to a string

integer() - converts an float or string to
an integer

float() - converts an integer or a string to
a float

charToNum() - converts a character to it's
ASCII code.

numToChar()- converts a ASCII code to its
corresponding character.

Examples:

put string (x)

put value ("123")

put float (1)

put integer (7.5)

put charToNum ("A")

put numToChar (65)

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)