String evalution

Just starting out? Need help? Post your questions and find answers here.
hessu
User
User
Posts: 25
Joined: Fri Nov 20, 2015 6:30 am

String evalution

Post 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
User avatar
Fig
Enthusiast
Enthusiast
Posts: 351
Joined: Thu Apr 30, 2009 5:23 pm
Location: Côtes d'Azur, France

Re: String evalution

Post by Fig »

You can't in native, use liberty basic. Image
Last edited by Fig on Fri Apr 21, 2017 1:51 pm, edited 2 times in total.
There are 2 methods to program bugless.
But only the third works fine.

Win10, Pb x64 5.71 LTS
User avatar
TI-994A
Addict
Addict
Posts: 2512
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: String evalution

Post 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
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
Kiffi
Addict
Addict
Posts: 1357
Joined: Tue Mar 02, 2004 1:20 pm
Location: Amphibios 9

Re: String evalution

Post by Kiffi »

http://www.purebasic.fr/english/viewtop ... 14#p362314

(bloated, but it works ;-))

Greetings ... Peter
Hygge
jack
Addict
Addict
Posts: 1336
Joined: Fri Apr 25, 2003 11:10 pm

Re: String evalution

Post by jack »

in your case I suggest http://www.purebasic.fr/english/viewtop ... hilit=eval, download link on last post
Post Reply