Bug 549 : code error in http://processing.org/reference/return.html page
Last modified: 2007-05-07 21:55




Status:
RESOLVED
Resolution:
FIXED -
Priority:
P2
Severity:
normal

 

Reporter:
miska
Assigned To:
REAS

Attachment Type Created Size Actions

Description:   Opened: 2007-04-27 04:33
Hi,

I found several errors in the second example on the following page:
http://processing.org/reference/return.html

buggy code (the last function):
(the arguments don't match the loop items, and the evaluation statement
doesn't work)
--------------------------

int[] vals = {10, 20, 30};

void draw() {
int[] t = timestwo(vals);
println(t);
noLoop();
}

int[] timestwo(int[] dVals) {
for(int i=0; idVals.length; i++) {
dVals[i] = dVals[i] * 2;
}
return dVals;
}

------------------------

In short,


this works better:
------------------------------------

int[] vals = {10, 20, 30};

void draw() {
int[] t = timestwo(vals);
println(t);
noLoop();
}

int[] timestwo(int[] idVals) {
for(int i=0; i<idVals.length; i++) {
idVals[i] = idVals[i] * 2;
}
return idVals;
}

--------------------------


Best,

/miska
Additional Comment #1 From REAS 2007-05-07 21:55
OK. Thank you. It's now fixed.