Conditional structures: Difference between revisions

Content deleted Content added
Added Scala
Line 1,535: Line 1,535:
=={{header|Harbour}}==
=={{header|Harbour}}==
'''if-elseif-else-endif'''
'''if-elseif-else-endif'''
<lang harbour>IF x == 1
<lang visualfoxpro>IF x == 1
SomeFunc1()
SomeFunc1()
ELSEIF x == 2
ELSEIF x == 2
Line 1,544: Line 1,544:


'''do case'''
'''do case'''
<lang harbour>DO CASE
<lang visualfoxpro>DO CASE
CASE x == 1
CASE x == 1
SomeFunc1()
SomeFunc1()
Line 1,555: Line 1,555:
'''switch'''
'''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.
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 harbour>SWITCH x
<lang visualfoxpro>SWITCH x
CASE 1
CASE 1
SomeFunc1()
SomeFunc1()
EXIT
CASE 2
CASE 2
SomeFunc2()
SomeFunc2()
EXIT
OTHERWISE
OTHERWISE
SomeFunc()
SomeFunc()
END</lang>
ENDSWITCH</lang>


=={{header|Haskell}}==
=={{header|Haskell}}==