nested Function
in
Programming Questions
•
2 years ago
Is there a simple way to have a function_IN inside a function_OUT?
(with function_IN having access to all function_OUT variables)
Some other languages allow it, but it doesn't seem to work here.
Of course I could put the function_IN outside instead, but then I would have to pass it the full exhaustive list of variables it may need.
Here is a trivial example of what I want, but it's not working.
- void setup() {
size(300,300);
background(153);
noLoop();
}//setup() - void draw() {
showA(5);
}//draw() - void showA(int a) {
- void showA1() { // ERROR: unexpected token: void <<<<
print("[1."+a+"] ");
}
void showA2() {
print("[2."+a+"] ");
} - showA1;
showA2;
}
1