Community Tip - Did you get called away in the middle of writing a post? Don't worry you can find your unfinished post later in the Drafts section of your profile page. X
I tried to create a program that can calculate capacity of a concrete column. However, I had a problem with matrixs and if/for loop. Even my input is a matrix; my output of for/if loop is a number. I could not solve that. Project is attached. I would be glad if anybody can help me and solve this.
Solved! Go to Solution.
Maybe this helps:
The result of a program is the result of the last executed statement before it ends.
If you run through a vector or matrix element by element and your last statement assigns the last element of your vector or matrix, than that (last element value) is the result of your program.
Note that in the programming palet there is a 'result' item which requires a parameter. You should use that at the end of your program, after any (nested) for loop and supply the (full) name of the result vector or matrix as the parameter.
Note that the 'result' item causes your program to stop. If you use it anywhere in a program, that's where it stops.
Success!
Luc
Maybe this helps:
The result of a program is the result of the last executed statement before it ends.
If you run through a vector or matrix element by element and your last statement assigns the last element of your vector or matrix, than that (last element value) is the result of your program.
Note that in the programming palet there is a 'result' item which requires a parameter. You should use that at the end of your program, after any (nested) for loop and supply the (full) name of the result vector or matrix as the parameter.
Note that the 'result' item causes your program to stop. If you use it anywhere in a program, that's where it stops.
Success!
Luc
Hello Luc,
Thanks for your answer. However, I did not use any "result" in the loop. I tried to use two "for" loops and one "if" to compare values of a matrix with two limits and get a new matrix. But it gives only the last parameter.
That's what I explained. The progam results in the last executed statement. That is e3j.
You HAVE to use 'result'.
Success!
Luc
Look at the difference here:
Success!
Luc
Thank you so much Luc 🙂
You're welcome.
Where I wrote 'result' it should have been 'return'.
But you understand now, I guess.
Luc