Page 1 of 1
One more calculation question.......
Posted: Fri Mar 27, 2015 2:42 pm
by Rage
Any idea how this: mon = round((24-12)/10)
could throw an error as being a double binary operator?
The same happened with :mon is round((24-12)/10)
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 2:59 pm
by dunbarx
Hi.
Not sure quite how you are forming your code, that is, how you are translating into proper LC syntax. The following works fine:
or:
How are you implementing this sort of thing?
Craig
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 4:19 pm
by FourthWorld
Craig's got it. In many other languages "=" is an assignment operator, resulting in millions of lost hours every year hunting down bugs related to the difference between "=" and "==" (it's sometimes fun to surf the Web with your browser's console open <g>).
LiveCode is immune to that particular productivity loss.
In LC "=" and its synonym "is" are always comparison operators, with assignment done using the "put" command.
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 4:20 pm
by Rage
Interestingly enough the second example you gave worked fine.
I'm trying to convert the system date to the Julian equivalent and for the most part seem to be getting
caught up on the syntax of the scripting language and finding work arounds for syntax not native to livecode.
Which is the major part of learning any new language of course...........
Is there some direction that might point to the proper syntax for programming livecode other than the documentation as
it seems a bit ambiguous.
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 5:24 pm
by dunbarx
It takes effort and time. LC seems so accessible that you might think you could learn how to drive in a few hours. It is indeed accessible, but it is also large and rich. The User Guide is a great start, the lessons are good, the dictionary is terrific, and there are other resources, like:
http://www.hyperactivesw.com/revscriptc ... ences.html
And there is this forum. You have to practice. You likely know this.
Craig
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 6:12 pm
by Rage
Thanks Craig, I've downloaded them and no doubt refer to them often.......
again Thanks
Re: One more calculation question.......
Posted: Fri Mar 27, 2015 6:25 pm
by FourthWorld
Rage wrote:Is there some direction that might point to the proper syntax for programming livecode other than the documentation as
it seems a bit ambiguous.
The Dictionary may seem ambiguous because it's a reference guide for specific syntax, and doesn't attempt to describe the overall flavor and flow of the language.
For that check out the User Guide, accessible from the Help menu. Chapter 5 provides a very good introduction to the language.