mirror of
https://github.com/EiffelSoftware/eiffel-org.git
synced 2025-12-06 14:52:03 +01:00
Update wikipage Conditional expression. (Signed-off-by:alexk).
git-svn-id: https://svn.eiffel.com/eiffel-org/trunk@1865 abb3cda0-5349-4a8f-a601-0c33ac3a8c38
This commit is contained in:
@@ -0,0 +1,31 @@
|
|||||||
|
[[Property:uuid|C652AC71-8BAD-4387-A46C-21C9F5C3A68F]]
|
||||||
|
[[Property:weight|0]]
|
||||||
|
[[Property:title|Conditional expression]]
|
||||||
|
[[Property:link_title|Conditional]]
|
||||||
|
= Conditional expression =
|
||||||
|
|
||||||
|
[[Eiffel%20Programming%20Language%20Syntax#Conditionals|Conditional expressions]] compute a value using different expressions depending on one or more conditions. If all expressions have the same type, the conditional expression as a whole has this type as well:
|
||||||
|
|
||||||
|
<e>
|
||||||
|
if time < noon then
|
||||||
|
"Good morning"
|
||||||
|
elseif time < evening then
|
||||||
|
"Good afternoon"
|
||||||
|
else
|
||||||
|
"Good evening"
|
||||||
|
end
|
||||||
|
</e>
|
||||||
|
|
||||||
|
has type `STRING`.
|
||||||
|
|
||||||
|
If the types of the expressions are different, the common ancestor type is used as a type of the whole expression.
|
||||||
|
|
||||||
|
<e>
|
||||||
|
if time < noon then
|
||||||
|
"Good morning"
|
||||||
|
else
|
||||||
|
Void
|
||||||
|
end
|
||||||
|
</e>
|
||||||
|
|
||||||
|
has type `detachable STRING`.
|
||||||
Reference in New Issue
Block a user