Conditional structures: Difference between revisions
Content added Content deleted
(Added Computer/zero Assembly) |
(Added FreeBASIC) |
||
Line 1,807: | Line 1,807: | ||
anew(1:n,1:m) = a(1:n,1:m) |
anew(1:n,1:m) = a(1:n,1:m) |
||
end where</lang> |
end where</lang> |
||
=={{header|FreeBASIC}}== |
|||
===IF-ELSEIF-ELSE-END IF=== |
|||
<lang freebasic>Dim a As Integer = 1 |
|||
If a = 1 Then |
|||
sub1 |
|||
ElseIf a = 2 Then |
|||
sub2 |
|||
Else |
|||
sub3 |
|||
End If</lang> |
|||
===SELECT-CASE=== |
|||
<lang freebasic>Dim a As Integer = 1 |
|||
Select Case a |
|||
Case 1 |
|||
sub1 |
|||
Case 2 |
|||
sub2 |
|||
Case Else |
|||
sub3 |
|||
End Select</lang> |
|||
===IFF=== |
|||
<lang freebasic>Dim b As Boolean = True |
|||
Dim i As Integer = IIf(b, 1, 2)</lang> |
|||
===ON-GOTO=== |
|||
<lang freebasic>Dim a As Integer = 1 |
|||
On a Goto label1, label2</lang> |
|||
===IF-GOTO (deprecated)=== |
|||
<lang freebasic>Dim b As Boolean = True |
|||
If b Goto label</lang> |
|||
===ON-GOSUB (legacy dialects only)=== |
|||
<lang freebasic>Dim a As Integer = 1 |
|||
On a Gosub label1, label2</lang> |
|||
===#IF-#ELSEIF-#ELSE-#ENDIF (preprocessor)=== |
|||
<lang freebasic>#DEFINE WORDSIZE 16 |
|||
#IF (WORDSIZE = 16) |
|||
' Do some some 16 bit stuff |
|||
#ELSEIF (WORDSIZE = 32) |
|||
' Do some some 32 bit stuff |
|||
#ELSE |
|||
#ERROR WORDSIZE must be set to 16 or 32 |
|||
#ENDIF</lang> |
|||
===#IFDEF (preprocessor)=== |
|||
<lang freebasic>#DEFINE _DEBUG |
|||
#IFDEF _DEBUG |
|||
' Special statements for debugging |
|||
#ENDIF</lang> |
|||
===#IFNDEF (preprocessor)=== |
|||
<lang freebasic>#IFNDEF _DEBUG |
|||
#DEFINE _DEBUG |
|||
#ENDIF</lang> |
|||
=={{header|friendly interactive shell}}== |
=={{header|friendly interactive shell}}== |
||
===if-then-else=== |
===if-then-else=== |