|
Hi together,
i'm trying since hours to call a block in Smalltalk recursively.
Can anybody help me with this ?
For example a want to write this JAVA function in Smalltalk:
public int calcNumber(int n) {
int result = 0;
if (n == 1) {
return 1;
} else if (n == 2) {
return 1;
} else {
result = calcNumber(n-1) + calcNumber(n-2);
}
return result;
}
The if clauses aren't the problem, only the recursively call of: result = calcNumber(n-1) + calcNumber(n-2);
Can anybody help me with this ?
|