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

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
Using RETURN
The
DisplayDivByZeroError
PUB Add(Num1, Num2)
PUB Divide(Dividend, Divisor)
The
RETURN
RETURN
in at the end of any methods that don’t have one.
The
DisplayDivByZeroError
method to return with the value 0. If, however, the
return Dividend / Divisor
division. This is an example where the last
return the result all in one step rather than separately affecting the built-in
beforehand.
Page 302 · Propeller Manual v1.0
Result := Num1 + Num2
return
if Divisor == 0
return Dividend / Divisor
Add
DisplayDivByZeroError
return 0
Divide
following
. The
was not really required because the Propeller Tool Compiler will automatically put it
method sets its built-in
– Spin Language Reference
method checks the
RETURN
example
causes
is a method defined elsewhere.
method and then executes
Add
, which causes the method to return with the result of the
demonstrates
to return the value of
RESULT
Divisor
variable equal to
RETURN
value.
two
Divisor
return 0
'Add Num1 + Num2
'Check if Divisor = 0
'If so, display error
'and return with 0
'Otherwise return quotient
was used to perform the calculation and
uses
If
RESULT
Divisor
was not equal to zero, it executes
of
, which immediately causes the
Num1
to the caller. Note that this
RETURN
plus
equals zero, it calls a
.
Num2
, then executes
RESULT
Assume
variable
that

Related parts for 122-32000