Value & parentheses when doing math
bobsneidar at iotecdigital.com
Mon Apr 2 17:57:14 EDT 2018
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.
> On Apr 2, 2018, at 14:48 , Knapp Martin via use-livecode <use-livecode at lists.runrev.com> 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
> add (item 4 of line x of tList) to tRunningTotal
> add value(item 4 of line x of tList) to tRunningTotal
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
More information about the Use-livecode