How to make an array, or range in Spin
TonyA
Posts: 226
Hi,
How can I set up an array, or declare a·range for a variable?
I want to have my variable select values from an array, or stay within a certain range of numbers.
Thanks,
Tony
How can I set up an array, or declare a·range for a variable?
I want to have my variable select values from an array, or stay within a certain range of numbers.
Thanks,
Tony
Comments
long/word/byte fictitious_name[noparse][[/noparse]n] (where n = size of array in longs/words/bytes)
You cannot havce a variable select values from an array or any other location. You CAN create a function that can get a value from an array of var's and assign a local variable that value for proccessing.
PUB main | local_variable_name
local_variable_name := fictitious_name[noparse][[/noparse]0] <-- access the first element in the array and assign the value to Local_variable_name
{ do some statement with local_variable_name }
I think more strongly that you want to use the Lookup or Lookdown function, it's in the manual.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
E3 = Thought
http://folding.stanford.edu/·- Donating some CPU/GPU downtime just might lead to a cure for cancer! My team stats.
Tony