please tell me why this 'for loop' does not work? (simple)
please tell me why this 'for loop' does not work? (simple)
never mind; silly question
Last edited by m127 on 10 Dec 2012 07:44, edited 1 time in total.
Re: please tell me why this 'for loop' does not work? (simpl
Code: Select all
for (i=myVals[0]; i<Major[1]; i++)
{
mySwitches.x[i]=1;
}
What should this loop do?
Re: please tell me why this 'for loop' does not work? (simpl
Hi
Well it does work in some way - It sets mySwitches.x[45] to 1; but like Rie said What do you expect it do?
And what is the Major array?? If Major[1] is less than myVals[0] it does nothing . . .
Also 'i' never gets incremented so it won't change from it's initial value of 45 . . .
'i' gets set to 45
if 'Major[1] is less than 45 it exits
if it larger than 45 the loop runs and sets mySwitches.x[45] to 1
counter increments
if Major[2] is less than 45 it exits
if larger, the loop runs and sets mySwitches.x[45] to 1
I think you will need either a 'while' or 'do while' rather than a 'for' . ..
Also sending a small example project is often better then just sending a script . . .
MM
Well it does work in some way - It sets mySwitches.x[45] to 1; but like Rie said What do you expect it do?
And what is the Major array?? If Major[1] is less than myVals[0] it does nothing . . .
Also 'i' never gets incremented so it won't change from it's initial value of 45 . . .
'i' gets set to 45
if 'Major[1] is less than 45 it exits
if it larger than 45 the loop runs and sets mySwitches.x[45] to 1
counter increments
if Major[2] is less than 45 it exits
if larger, the loop runs and sets mySwitches.x[45] to 1
I think you will need either a 'while' or 'do while' rather than a 'for' . ..
Also sending a small example project is often better then just sending a script . . .
MM
iMac 2.8G i7 12G 10.6.8/10.7.2, Legacy Dexter/Lemur, Liine Lemur/iPad2, KMI SoftStep, 12Step & QuNeo , B-Controls, Mackie C4 etc
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]
MaxMSP, Live Suite, Native Instrument stuff, etc Modified Virtual Guitar System etc All Projects/Modules © CC-BY-NC-SA[*][/b]