Welcome Guest! To enable all features please Login. New Registrations are disabled.

Notification

Icon
Error

Login


Options
Go to last post Go to first unread
Offline sinneD  
#1 Posted : 06 November 2018 01:55:09(UTC)
sinneD


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

loop-opti.png

Edited by user 06 November 2018 07:59:36(UTC)  | Reason: Not specified

Join the SMath Studio Users Discord Channel: https://discord.gg/PayZpJW

Wanna join the discussion?! Login to your SMath Studio Forum forum account. New Registrations are disabled.

Offline Jean Giraud  
#2 Posted : 06 November 2018 06:06:24(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: sinneD Go to Quoted Post
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).


Offline Jean Giraud  
#3 Posted : 06 November 2018 17:10:19(UTC)
Jean Giraud

Rank: Guest

Groups: Registered
Joined: 04/07/2015(UTC)
Posts: 6,866
Canada

Was thanked: 981 time(s) in 809 post(s)
Originally Posted by: sinneD Go to Quoted Post
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).
thanks 1 user thanked Jean Giraud for this useful post.
on 06/11/2018(UTC)
Users browsing this topic
Guest
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.