If Expressions

From The Oxygene Language Wiki

Jump to:navigation, search

This is a Language topic
Feel free to add your notes to this topic below.



If expressions, introduced in the May 2010 release, are a simple way to write conditional expressions inline.

The syntax is like an IF statement, with expressions after the "then" and (optionally) "else". The Else is optional, and when missing, the result will be nil for false.

The result type will be the closest type both types fit in, if one side is nil and the other a value type, the result will be a nullable type.

MessageBox.Show(
  (if SingleUser then 
    'Are you sure you want to remove this user?' 
  else 
  'Are you sure you want to remove these users?'), 
  MessageBoxButtons.YesNo)


See Also


Oxygene-48.png

Area: Oxygene Language
Compiler version: Oxygene 5

Language GlossaryKeywordsTypesFAQHow To

Navigation
Areas
More
Toolbox