Please attach your worksheet (upper left - "Use advanced editor")
What does "not work".
Did you expect the nested for-loops to have any effect on the worksheet variable g31? Is hasn't.
Inside program structures everything on the left of a local assignment is treated as a local variable, so the variable g31 you change in your program has nothing to do with the WS variable you obviously wish to change.
Solution: Assign the program a variable by writing "ge31:=for j ....". Then as the first line of your program write "g31<-- g31". While this may look silly, keep in mind, that the left g31 is the uninitialized local variable, whereupon the right g31 is the worksheet variable. As from now on a local g31 exists, MC would use this local variable on the RHS of the subsequent local assigments, too.
At the end of your programm add "return g31"
This should do the job
In short: You cannot change a worksheet variable from within a program. Only way to do is to assign the program result to that variable.
Thank you very much, Werner, for your reply! Did you mean the following code (see attached fibbonachi_test.xcmd)?
Unfortunately, It still doesn't calculate a Fibbonachi sequence in each column.
Actually, I'm debugging a more complex program, and I tried to sort out with the issues using a simple example.
In another attached worksheet there is vector-function initialised by the program block, which contains a long while loop. Since certain moment of writing the program it has been beginning to generate an exception coloring the whole loop by red. Can you advice any proper way, how to debug such a complex code row by row in MathCAD?