使用ProcessingJS,我有一个函数可以确定我想要给另一个函数的数字:
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);
}
出于某种原因,现在numberLong = aLongNumber
并且没有添加(number * aLongNumber),因为在调用了Number()之后,number还没有传递给mousePressed();
答案 0 :(得分:3)
试试这个,看看你是否得到了所需的结果:
int number = 0;
int theNumbers() {
number = 10; // sample number
return number;
}
void mousePressed() {
number = theNumbers();
long numberLong = aLongNumber + (number * aLongNumber);
}