1: apple
2: carrot
3: dapple
4: fapple
5: gourd
FUNCTION testNext()
testA = ["apple", 2, "carrot", "dapple", 5, "fapple", "gourd"]
testInt = 0
FOR EACH fruit IN testA
IF TYPE(fruit) = "roString"
testInt++
? "testNext() found a String, fruit " fruit ", testInt" testInt
' And do 50 more lines of code,
' all indented to be within this huge IF block,
' instead of just skipping to next item in list,
' too bad
' Could maybe use GOTO but that's not something I like to do,
' So the IF block with indenting is the lesser of two evils!
END IF
END FOR
END FUNCTION
FUNCTION testNext()
testA = ["apple", 2, "carrot", "dapple", 5, "fapple", "gourd"]
testInt = 0
FOR i = 0 to testA.count()-1
IF TYPE( testA[i]) = "roString"
testInt++
? "testNext() found a String, fruit " testA[i] ", testInt" testInt
ELSE
END IF
END FOR
END FUNCTION
testNext() found a String, fruit apple, testInt 1
testNext() found a String, fruit carrot, testInt 2
testNext() found a String, fruit dapple, testInt 3
testNext() found a String, fruit fapple, testInt 4
testNext() found a String, fruit gourd, testInt 5
"speechles" wrote:
Still not sure what you want to do but If I knew I bet I could figure out how to do what you want.. ^_~
Function doFruit(num As Integer, fruit As String)
' Do all the fruit processing here ... '
? num; ": "; fruit
End Function
Sub Main()
testA = ["apple", 2, "carrot", "dapple", 5, "fapple", "gourd"]
num = 0
For Each fruit In testA
If Type(fruit) = "roString" Then doFruit(num, fruit) : num++
End For
End Sub
0: apple
1: carrot
2: dapple
3: fapple
4: gourd