122-32000 Parallax Inc, 122-32000 Datasheet - Page 244

MANUAL PROPELLER

122-32000

Manufacturer Part Number
122-32000
Description
MANUAL PROPELLER
Manufacturer
Parallax Inc
Datasheets

Specifications of 122-32000

Accessory Type
Manual
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
For Use With/related Products
Propeller Education (PE) Kit
Lead Free Status / Rohs Status
Lead free / RoHS Compliant
LOOKUP, LOOKUPZ
Get value from an indexed position within a list.
((PUB ┆ PRI))
((PUB ┆ PRI))
Returns: Value at the one-based Index position (
(
Explanation
LOOKUP
the value from ExpressionList that is located in the one-based position (1..N) given by Index.
LOOKUPZ
Index is out of range then 0 is returned.
Using LOOKUP or LOOKUPZ
LOOKUP
1, 2, etc.) to a set of non-contiguous numbers (45, -103, 18, etc.) where no algebraic
expression can be found to do so concisely. The following example assumes
method created elsewhere.
PUB ShowList | Index, Temp
This example looks up all the values in
REPEAT
retrieve a value from its list. If
value 300 is returned. Assuming
example will print 25, 300, 2510, 163, 17, 8000 and 3 on a display.
Page 244 · Propeller Manual v1.0
LOOKUPZ
LOOKUP
LOOKUPZ
repeat Index from 1 to 7
Temp := lookup(Index: 25, 300, 2_510, 163, 17, 8_000, 3)
Print(Temp)
and
loop counts with
and
Index
For
ExpressionList
are also allowed; they are treated as a comma-separated list of characters.
is just like
) of ExpressionList, or 0 if out-of-range.
( Index : ExpressionList )
LOOKUPZ
LOOKUPZ
LOOKUP
( Index : ExpressionList )
is an expression indicating the position of the desired value in ExpressionList.
, Index is one-based (1..N). For
LOOKUP
are useful for mapping a contiguous set of numbers (1, 2, 3, etc. –or– 0,
are commands that retrieve entries from a list of values.
is a comma-separated list of expressions. Quoted strings of characters
Index
except it uses a zero-based Index (0..N-1). For both commands, if
– Spin Language Reference
from 1 to 7. Each iteration of the loop,
Index
Print
equals 1, the value 25 is returned. If
is a method that displays the value of
LOOKUP
’s ExpressionList and displays them. The
LOOKUPZ
LOOKUP
, Index is zero-based (0..N-1).
) or zero-based Index position
LOOKUP
Index
LOOKUP
uses
equals 2, the
Print
Temp
Index
returns
, this
is a
to

Related parts for 122-32000