Quote:
but lets say i wanted the array to hold data that is not all the same and it was a very large array so i didn't want to write it as
Array(1) = 0
Array(2) = 1
Array(3) = 1
Array(4) = 0
etc...
Array(30) = 1
cause that would take up too many lines as apposed to
dim Array(16) as bit = (0,0,0,1,1,1,0,0,0,1,0,1,0,0,0,0,0,0,0,1,1,0,0,0,0,0,1,0,0,0,0,0)
but the above code is not valid
Sadly in Swordfish you cant Intialise Arrays the same way as a Constant Array.
So we are either left with typing out every line of the Array or we use a Repetitive statement for example a FOR Loop.
It looks like you have an Bit Array so something like this?
Code:
Dim Index as byte
Dim Array(16) as bit
For Index = 0 to bound(Array)
If Index = 1 Or Index = 2 Or Index = 4 Or Index = 9 Or Index = 16 then
Array(Index) = 1
Else
Array(Index) = 0
EndIf
Next
So in the example above. Array(1),Array(2),Array(4),Array(9),Array(16) = 1
all other Array elements will = 0
Note that the first element of an array is located at 0, the second element at 1 and so on. Because Swordfish arrays begin with zero indexes.
so the Array code above will output something like this (0,1,1,0,1,0,0,0,0,1,0,0,0,0,0,0,1)