DelphiTools – “if” expressions are now supported in DWScript SVN, those were introduced to Pascal by Oxygene a couple years back, and are Pascal’s verbose version of the C ternary operator (?:). For instance var s := if (a<>0) then Sin(1/a) else 1; being equivalent to var s : Float; if (a<>0) then s := Sin(1/a) else s := 1; This can allow to eliminate the need for some intermediate variables and repetitions. However the DWScript version is a bit stricter than the Oxygene version in that it won’t automatically box incompatible values to “Object”, it it will ...
Visits by Source
Users who voted for this posting
Jørn E. Angeltveit