Page 1 of 1

String evalution

Posted: Fri Apr 21, 2017 1:27 pm
by hessu
Hi Everybody
This is an example code in Liberty basic :

input "Type a numeric expression>"; code$
answer = eval(code$)
print answer

For instance If I type 5+5
I'll get 10

How to do this in Purebasic ?

I found nothing in PB 5.60 help section.

I need this badly

Re: String evalution

Posted: Fri Apr 21, 2017 1:39 pm
by Fig
You can't in native, use liberty basic. Image

Re: String evalution

Posted: Fri Apr 21, 2017 1:40 pm
by TI-994A
hessu wrote:

Code: Select all

answer = eval(code$)
I don't believe PureBasic has a built-in expression evaluator. Here's one by utopiomania, among others:

> Expression evaluator

Re: String evalution

Posted: Fri Apr 21, 2017 2:09 pm
by Kiffi
http://www.purebasic.fr/english/viewtop ... 14#p362314

(bloated, but it works ;-))

Greetings ... Peter

Re: String evalution

Posted: Fri Apr 21, 2017 6:50 pm
by jack
in your case I suggest http://www.purebasic.fr/english/viewtop ... hilit=eval, download link on last post