Code: Select all
;/ Anonymous structures for parameter types
Procedure.i Compare(*a.?, *b.?)
If *a\? > *b\?
ProcedureReturn 1
EndIf
If *a\? < *b\?
ProcedureReturn -1
EndIf
ProcedureReturn 0
EndProcedure
a.Integer\i=1
b.Integer\i=2
;/ Output: -1
Debug Compare(@a,@b)
c.i=3
d.i=2
;/ Variables can be copy-assigned anonymously to structures with '->'
;/ Output: 1
Debug Compare(c->Integer,d->Integer)
;/ Structures of the same type can be copy-assigned as well
;/ Output: 0
Debug Compare(a->Integer,a->Integer)
;/ Literals are automatically promoted. Here, 1->Integer and 2.0->Double
Debug Compare(1,2.0)
;/ Literals as 1->Integer and 2.0->Float
Debug Compare(1,2.0->Float)