Conditional structures: Difference between revisions
Update Ursalang example to include explanation and "else if" example.
imported>Maleza No edit summary |
(Update Ursalang example to include explanation and "else if" example.) |
||
Line 8,065:
=={{header|Ursalang}}==
===
Ursalang has a single conditional construct, the familiar `if…then…else`.<syntaxhighlight lang="ursalang">
if energyLevel > 9000 { "That's impossible!!!" } else { "Ok, I guess" }
</syntaxhighlight>As in most C-like languages, conditionals can be chained:<syntaxhighlight>
if color == "red" { "aaaaaah!" }
else if color == "blue" { "oooooh!" }
else { "eeeeeeee!" }
</syntaxhighlight>
|