How to resolve the algorithm Conditional structures step by step in the FreeBASIC programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Conditional structures step by step in the FreeBASIC programming language
Table of Contents
Problem Statement
List the conditional structures offered by a programming language. See Wikipedia: conditionals for descriptions. Common conditional structures include if-then-else and switch. Less common are arithmetic if, ternary operator and Hash-based conditionals. Arithmetic if allows tight control over computed gotos, which optimizers have a hard time to figure out.
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Conditional structures step by step in the FreeBASIC programming language
Source code in the freebasic programming language
Dim a As Integer = 1
If a = 1 Then
sub1
ElseIf a = 2 Then
sub2
Else
sub3
End If
Dim a As Integer = 1
Select Case a
Case 1
sub1
Case 2
sub2
Case Else
sub3
End Select
Dim b As Boolean = True
Dim i As Integer = IIf(b, 1, 2)
Dim a As Integer = 1
On a Goto label1, label2
Dim b As Boolean = True
If b Goto label
Dim a As Integer = 1
On a Gosub label1, label2
#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
#DEFINE _DEBUG
#IFDEF _DEBUG
' Special statements for debugging
#ENDIF
#IFNDEF _DEBUG
#DEFINE _DEBUG
#ENDIF
You may also check:How to resolve the algorithm Hello world/Standard error step by step in the PureBasic programming language
You may also check:How to resolve the algorithm Search a list of records step by step in the Nim programming language
You may also check:How to resolve the algorithm Factorial step by step in the friendly interactive shell programming language
You may also check:How to resolve the algorithm Literals/Floating point step by step in the Maple programming language
You may also check:How to resolve the algorithm Send email step by step in the VBA programming language