I can add but I can't subtract!

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: Klaus, FourthWorld, heatherlaine, kevinmiller, robinmiller

Post Reply
bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

I can add but I can't subtract!

Post by bjb007 » Tue Feb 19, 2008 9:10 pm

I can

add 1 to field lblXXX

but how do I subtract 1?

Tried adding (-1) and got a raspberry from Rev.

Can't find anything like

field lblXXX = field lblXXX -1

or

field lblXXX -=1
Life is just a bowl of cherries.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Tue Feb 19, 2008 9:32 pm

Hi,

again, script would be helpful. :)

--
on mouseUp pMouseBtnNo
local myVar
put 5 into myVar
add (-1) to myVar
put myVar
end mouseUp

subtract 1 from myVar

put myVar -1 into myVar

Many choices...

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Tue Feb 19, 2008 9:35 pm

Just checked the transcript dictionary...


subtract is nicely linked from add ;-)

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Mathematical Moron

Post by bjb007 » Tue Feb 19, 2008 9:48 pm

I think I failed every mathematics exam I
ever took so you shouldn't be surprised
that I didn't look for "subtract".

Not the usual way in programming.

As I said before I look for something familiar
like += and -+.

And on top of all that it's 8am in Melbourne
and I haven't gone to bed yet.
Last edited by bjb007 on Tue Feb 19, 2008 10:03 pm, edited 1 time in total.
Life is just a bowl of cherries.

malte
Posts: 1098
Joined: Thu Feb 23, 2006 8:34 pm
Location: Ostenfeld germany
Contact:

Post by malte » Tue Feb 19, 2008 9:58 pm

The hardest part about learning Rev if you have previous (non hypercard) programming experience, is to unlearn the things you already know. I agree there should be better documentation for potential switchers from other languages, where syntactic differences like those are covered.

All the best,

Malte

paul_gr
Posts: 320
Joined: Fri Dec 08, 2006 7:38 pm
Location: Blenheim, New Zealand

Post by paul_gr » Tue Feb 19, 2008 10:58 pm

In most of the dictionary pages, there is a "See also ..." list of related functions.
These are hyperlinked (although it isn't obvious) to the relevant page.
It also pays to think in terms of a word rather than a symbol, ie think "add"instead of +.
I really miss things like i++,+= and -=, but you've got to go with the flow :)

cheers
Paul

bjb007
Posts: 313
Joined: Fri Dec 28, 2007 4:56 am

Post by bjb007 » Tue Feb 19, 2008 11:55 pm

The add and subtract were in V1 but one would expect
that some more usual version would have been added
by now.

Although Rev is a nice language to use it never seems
to be well maintained or updated.

Anyway it's better than C or C++ which are a big
joke.
Life is just a bowl of cherries.

JeremyR
Posts: 19
Joined: Tue Mar 06, 2007 9:31 am

Post by JeremyR » Wed Feb 20, 2008 10:20 am

Your "usual version" is judged coming from your lack of background in xtalk languages. I don't mean to be harsh, but from all your posts you are wanting revolution/xtalk to be c/c++.

Basically your asking for xtalk to take away the one thing that makes it stand out from the "usual" programming languages, its english-like syntax (or readability in other words). :wink:

Klaus
Posts: 11588
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Post by Klaus » Wed Feb 20, 2008 11:24 am

Well put, Jeremy :-)

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”