Computer Science Canada "variable has no value" |
Author: | gsquare567 [ Sun May 11, 2008 3:55 pm ] | ||
Post subject: | "variable has no value" | ||
2 questions: 1) How can i get the length of a pre-set array 2) Why am i not allowed to dynamically initialize an array here : (focus on exactNoteTimes array) i preset 0 and then in the second last line use it to to make 1, which is used to make 2, etc. so if i preset 0 then why is i-1 not set? the first run it will pe 1-1 = 0, and 0 is 3000 (note the second line). in the last line i set exactNoteTimes(i) and then the next run it will be i-1, so there should be no problem.
|
Author: | Dan [ Sun May 11, 2008 7:40 pm ] | ||
Post subject: | RE:"variable has no value" | ||
1) To get the upper limit you can use the function upper and to get the lower limit you can use the function lower. Example:
2) I am kind of confused by your question and code snipit. But my guses is that if any of the if stamets are not ture the array will not have an element set and there will be no value for the next time the ifs become true. for example if i = 1 and noteStatus (1) not = 1 then exactNoteTimes (1) will not be set and on the next loop if noteStatus (2) = 0 and lastTimeSent + noteTimeIncreases (2) <= Time.Elapsed then exactNoteTimes(2-1) will be undefined. |