Conditional structures: Difference between revisions

(Added Scala)
Line 1,535:
=={{header|Harbour}}==
'''if-elseif-else-endif'''
<lang harbourvisualfoxpro>IF x == 1
SomeFunc1()
ELSEIF x == 2
Line 1,544:
 
'''do case'''
<lang harbourvisualfoxpro>DO CASE
CASE x == 1
SomeFunc1()
Line 1,555:
'''switch'''
While '''if-elseif-else-endif''' and '''do case''' constructions allows using of any expressions as conditions, the '''switch''' allows literals only in conditional '''case''' statements. The advantage of the '''switch''' command is that it is much faster.
<lang harbourvisualfoxpro>SWITCH x
CASE 1
SomeFunc1()
EXIT
CASE 2
SomeFunc2()
EXIT
OTHERWISE
SomeFunc()
ENDENDSWITCH</lang>
 
=={{header|Haskell}}==