Re: Value & parentheses when doing math

2018-04-02 Thread Tom Glod via use-livecode
the 2nd one is the one most readable to me so thats the one i would use

On Mon, Apr 2, 2018 at 6:08 PM, Richard Gaskin via use-livecode <
use-livecode@lists.runrev.com> wrote:

> Knapp Martin wrote:
> > I have a tab delimited list where item 4 is a number and I'm adding
> > things up. What is considered best practice when doing this?
> >
> > add item 4 of line x of tList to tRunningTotal
> > or
> > add (item 4 of line x of tList) to tRunningTotal
> > or
> > add value(item 4 of line x of tList) to tRunningTotal
> >
> > Marty
>
> IMO whatever is the easiest to write and read that gets the job done is
> the best option.
>
> The first example above seems simplest to me.
>
> The second one isn't bad, but the third one should be avoided unless you
> have something in the data that requires the overhead of adding a call to
> the value function.
>
> --
>  Richard Gaskin
>  Fourth World Systems
>  Software Design and Development for the Desktop, Mobile, and the Web
>  
>  ambassa...@fourthworld.comhttp://www.FourthWorld.com
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Value & parentheses when doing math

2018-04-02 Thread Richard Gaskin via use-livecode

Knapp Martin wrote:
> I have a tab delimited list where item 4 is a number and I'm adding
> things up. What is considered best practice when doing this?
>
> add item 4 of line x of tList to tRunningTotal
> or
> add (item 4 of line x of tList) to tRunningTotal
> or
> add value(item 4 of line x of tList) to tRunningTotal
>
> Marty

IMO whatever is the easiest to write and read that gets the job done is 
the best option.


The first example above seems simplest to me.

The second one isn't bad, but the third one should be avoided unless you 
have something in the data that requires the overhead of adding a call 
to the value function.


--
 Richard Gaskin
 Fourth World Systems
 Software Design and Development for the Desktop, Mobile, and the Web
 
 ambassa...@fourthworld.comhttp://www.FourthWorld.com

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: Value & parentheses when doing math

2018-04-02 Thread Bob Sneidar via use-livecode
The second one is more readable. The third is unnecessary. The first works just 
fine. It just depends on how readable you want to make your code for others. I 
always take the time to put values into their own variables so I can point at 
them in the debugger and see their current values in the stepper. So:

put item 4 of line x of tList into tValue
add tValue to tRunningTotal

seems to me to be more readable, at the expense of a little extra typing. 

Bob S


> On Apr 2, 2018, at 14:48 , Knapp Martin via use-livecode 
>  wrote:
> 
> I have a tab delimited list where item 4 is a number and I'm adding things 
> up. What is considered best practice when doing this?
> 
> add item 4 of line x of tList to tRunningTotal
> or
> add (item 4 of line x of tList) to tRunningTotal
> or
> add value(item 4 of line x of tList) to tRunningTotal
> 
> Marty
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Value & parentheses when doing math

2018-04-02 Thread Knapp Martin via use-livecode
I have a tab delimited list where item 4 is a number and I'm adding things up. 
What is considered best practice when doing this?

add item 4 of line x of tList to tRunningTotal
or
add (item 4 of line x of tList) to tRunningTotal
or
add value(item 4 of line x of tList) to tRunningTotal

Marty
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode