Page 1 of 1

I can add but I can't subtract!

Posted: Tue Feb 19, 2008 9:10 pm
by bjb007
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

Posted: Tue Feb 19, 2008 9:32 pm
by malte
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...

Posted: Tue Feb 19, 2008 9:35 pm
by malte
Just checked the transcript dictionary...


subtract is nicely linked from add ;-)

Mathematical Moron

Posted: Tue Feb 19, 2008 9:48 pm
by bjb007
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.

Posted: Tue Feb 19, 2008 9:58 pm
by malte
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

Posted: Tue Feb 19, 2008 10:58 pm
by paul_gr
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

Posted: Tue Feb 19, 2008 11:55 pm
by bjb007
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.

Posted: Wed Feb 20, 2008 10:20 am
by JeremyR
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:

Posted: Wed Feb 20, 2008 11:24 am
by Klaus
Well put, Jeremy :-)