September 2017 Update
This commit is contained in:
parent
bba7bfd280
commit
ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions
18
Task/Loops-Foreach/BASIC/loops-foreach-5.basic
Normal file
18
Task/Loops-Foreach/BASIC/loops-foreach-5.basic
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
' FB 1.05.0
|
||||
|
||||
' FreeBASIC doesn't have a foreach loop but it's easy to manufacture one using macros
|
||||
|
||||
#Macro ForEach(I, A)
|
||||
For _i as integer = LBound(A) To UBound(A)
|
||||
#Define I (A(_i))
|
||||
#EndMacro
|
||||
|
||||
#Define In ,
|
||||
|
||||
Dim a(-5 To 5) As Integer = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11}
|
||||
ForEach(i in a)
|
||||
Print i; " ";
|
||||
Next
|
||||
|
||||
Print
|
||||
Sleep
|
||||
Loading…
Add table
Add a link
Reference in a new issue