SMath Studio Forum
»
SMath Studio
»
Questions
»
Program loops- one big one or a few smaller ones
Rank: Advanced Member Groups: Registered
Joined: 12/03/2011(UTC) Posts: 101 Location: Chicago
Was thanked: 16 time(s) in 7 post(s)
|
Hi all- I am trying to build good habits as I learn and grow my SMATH skills- I have a calc sheet with 3 programming loops in it. I realized that I have 2 loops side by side to one, and then there are others ordered as a list under those. In each of them, I j as my step variable- just because that is how I learned for-then loops ages ago. It occurred to me that I might be setting myself up for trouble as I build and expand things. Is there 'better' way to organize this? How do you break things like loops to be more human readable? Can you reuse the loop variables like this? Should each loop have its own variable, or should they all use the same one? EDIT: Here is a screen shot with the regions and loops I am referring to. Dennis Edited by user 06 November 2018 07:59:36(UTC)
| Reason: Not specified |
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: sinneD Can you reuse the loop variables like this ? Shoud each loop have its own variable, or shoud they all use the same one ? On that, answer is not clear cut. In many instances, Smath behave like Mathcad global definition. Interesting but source of problem. It does not generally evaporate previous use of variables. The safe way to debug is modular piece-wise construction. In unexplored limits, the right produces wrong. Smath is superb for detecting errors as long as it is not too far deep embedded. On the other hand, bear in mind the QA [Quality Assurance], they work piece-wise. The attached De Casteljau is a good example of chained style construction. As well, visit Samples for the latest "Draghilev Revisited". Jean Spline De Casteljau SVG Companion.sm (99kb) downloaded 17 time(s).
|
|
|
|
Rank: Guest
Groups: Registered
Joined: 04/07/2015(UTC) Posts: 6,866 Was thanked: 981 time(s) in 809 post(s)
|
Originally Posted by: sinneD Here is a screen shot with the regions and loops I am referring to. As it looks Dennis, all that invisible stuff is a collection of individual pieces. X_Y Plot wisely [Lines].sm (13kb) downloaded 21 time(s).
|
1 user thanked Jean Giraud for this useful post.
|
|
|
SMath Studio Forum
»
SMath Studio
»
Questions
»
Program loops- one big one or a few smaller ones
Forum Jump
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.