With ProcessingJS, I have a function that determines a number that I would like to give to another function:
int number;
int theNumbers() {
// calculations for number
int number = 10; // sample number
return number;
}
void mousePressed() {
// calculations for aLongNumber
// pass theNumbers() number value
theNumbers();
long numberLong = aLongNumber + (number * aLongNumber);
}
For some reason, right now numberLong = aLongNumber
and doesn't add (number * aLongNumber) because number has yet to pass to mousePressed() after calling theNumbers();
Try this and see if you get the required results:
int number = 0;
int theNumbers() {
number = 10; // sample number
return number;
}
void mousePressed() {
number = theNumbers();
long numberLong = aLongNumber + (number * aLongNumber);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.