Mailing List Archive: 49091 messages
  • Home
  • Script library
  • AltME Archive
  • Mailing list
  • Articles Index
  • Site search
 

[REBOL] Re: let's re-visit math oper. in a var.

From: mumpsoid:gmx at: 4-Apr-2009 7:55

On Sat, 4 Apr 2009, Anton Rolls wrote:
> Just before you go, try this: > Paste it into your console or put it in a script. > > print "Press escape to exit the loop." > forever [ > num1: to-integer ask "Enter the 1st number: " > num2: to-integer ask "Enter the 2nd number: " > op: all [pos: find "+-*/" ask "Enter an operator [+ - * /]: " get to-word form first pos] > result: op num1 num2 > print ["result:" result] > ] > > Note that TO-INTEGER needs valid input, or errors to be trapped, > but we can add that later. OP is here guaranteed to be one of the > four operators or NONE (thanks to ALL). > > Regards, > Anton. > > mumpsoid-gmx.com wrote: > > No joy.... > > > > Thanks for your input! as well as everybody on the list. > > I think that I'm going to leave REBOL alone for awhile, until > > I cool off. have a good one....
I see that I wa using the "to-integer' function in the wrong place... Your "op:" assignment line is of course the key (kudos to you) and I suspect contains a lot of "keys" to understanding REBOL. Nice little script! Thanks for the extra mile.... BTW, it works exactly as to what I had in mind. I don't _need_ this calculator for anything -- it's merely a learning project. Thanks again. -- Duke Normandin A: Because it messes up the order in which people normally read text. Q: Why is top-posting such a bad thing? A: Top-posting. Q: What is the most annoying thing in e-mail?