Conditional structures: Difference between revisions

Line 2,924:
Checkit 3, 20
 
</lang>
 
Ternary can used as Elvis operator (a function here), when a false (or a Nothing, for some kind of objects) evaluated then return something after ->, else return true or the object so if A is object then If(A->,B)
 
<lang M2000 Interpreter>
Module Checkit {
def a
Print type$(a)="Double"
b=(1,2,3,4)
for i=1 to 3
a=if(a->, b) ' this happen only one time, where a is a double, second time a is an object
Print a ' print 3 values
a++ ' add 1 to each value
Print type$(a)="mArray"
Next i
}
Checkit
</lang>
 
Anonymous user