5
votes
Vote UpVote

if then (else) expressions

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 ...
Favorite? Off-Topic? Eric @ 2013-01-08 13:59

Statistics

Visits: 930
Votes: 5
Favorites: 1
Off-Topic: 0

Visits by Source

User Actions

Users who voted for this posting

Ericc
Jørn E. Angeltveit
Radosław Kokoć
Yogi Yang
Zzzzz
Subscribe:
Contact us to advertise on DelphiFeeds.com

Community Links

Torry Firebird News

Sponsor

 
Please login or register to use this functionality.
(click on this box to dismiss)