Anonymous user
Loops/Foreach: Difference between revisions
Moved NS-HUBASIC, VBA, VBScript to existing BASIC section
(Add LIL) |
(Moved NS-HUBASIC, VBA, VBScript to existing BASIC section) |
||
Line 474:
Very good!
Fantastically good!
==={{header|NS-HUBASIC}}===▼
<lang NS-HUBASIC>10 DIM A$(9) : REM DECLARE STRING ARRAY▼
20 REM ADD DATA TO ARRAY AND PRINT ARRAY CONTENTS▼
30 FOR I=0 TO 8▼
40 READ A$(I)▼
50 PRINT A$(I)" ";▼
60 NEXT▼
70 DATA THE, QUICK, BROWN, FOX, JUMPS, OVER, THE, LAZY, DOG.</lang>▼
==={{header|PureBasic}}===
Line 495 ⟶ 504:
Disp strs[i]
EndFor</lang>
==={{header|VBA}}===▼
<lang VB>Public Sub LoopsForeach()▼
Dim FruitArray() As Variant▼
Dim Fruit As Variant▼
FruitArray = [{"Apple","Banana","Strawberry"}]▼
Dim FruitBasket As Collection▼
Set FruitBasket = New Collection▼
For Each Fruit In FruitArray▼
FruitBasket.Add Fruit▼
Next Fruit▼
For Each Fruit In FruitBasket▼
Debug.Print Fruit▼
Next Fruit▼
End Sub</lang>▼
==={{header|VBScript}}===▼
<lang vbscript>items = Array("Apple", "Orange", "Banana")▼
For Each x In items▼
WScript.Echo x▼
Next</lang>▼
==={{header|Visual Basic .NET}}===
Line 1,617 ⟶ 1,648:
dolor
</pre>
▲=={{header|NS-HUBASIC}}==
▲<lang NS-HUBASIC>10 DIM A$(9) : REM DECLARE STRING ARRAY
▲20 REM ADD DATA TO ARRAY AND PRINT ARRAY CONTENTS
▲30 FOR I=0 TO 8
▲40 READ A$(I)
▲50 PRINT A$(I)" ";
▲60 NEXT
▲70 DATA THE, QUICK, BROWN, FOX, JUMPS, OVER, THE, LAZY, DOG.</lang>
=={{header|Objective-C}}==
Line 2,276 ⟶ 2,298:
=={{header|V}}==
<lang v>[1 2 3] [puts] step</lang>
▲=={{header|VBA}}==
▲<lang VB>Public Sub LoopsForeach()
▲ Dim FruitArray() As Variant
▲ Dim Fruit As Variant
▲ FruitArray = [{"Apple","Banana","Strawberry"}]
▲ Dim FruitBasket As Collection
▲ Set FruitBasket = New Collection
▲ For Each Fruit In FruitArray
▲ FruitBasket.Add Fruit
▲ Next Fruit
▲ For Each Fruit In FruitBasket
▲ Debug.Print Fruit
▲ Next Fruit
▲End Sub</lang>
▲=={{header|VBScript}}==
▲<lang vbscript>items = Array("Apple", "Orange", "Banana")
▲For Each x In items
▲ WScript.Echo x
▲Next</lang>
=={{header|Vim Script}}==
|