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

[REBOL] Re: Evaluating a maths expression in a string?

From: larry:ecotope at: 29-Dec-2000 10:48

Hi Mat
> The question is, if I get a string which contains a mathematical > expression - how would you evaluate this and get the result?
Here is one way:
>> str: "3 + 4"
== "3 + 4"
>> either not error? try[result: do str][result]["code to handle error"]
== 7
>>
HTH -Larry