calculating within a variable

Anything beyond the basics in using the LiveCode language. Share your handlers, functions and magic here.

Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller

Post Reply
scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

calculating within a variable

Post by scotttyang » Wed Jan 22, 2014 6:09 am

If I put "1+1" into x

but if I put x, I get "1+1"

how can I do a calculation of the variable x so I can get the answer of 2?

Is it possible?

Scott

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10058
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: calculating within a variable

Post by FourthWorld » Wed Jan 22, 2014 6:11 am

The quotes tell LiveCode to treat everything between them as a literal string. Remove the quotes and try again.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

scotttyang
Posts: 125
Joined: Sat Jan 31, 2009 12:01 am

Re: calculating within a variable

Post by scotttyang » Wed Jan 22, 2014 6:19 am

How can i convert the literal back to a calculation....?

FourthWorld
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 10058
Joined: Sat Apr 08, 2006 7:05 am
Contact:

Re: calculating within a variable

Post by FourthWorld » Wed Jan 22, 2014 6:48 am

Remove the quotes.
Richard Gaskin
LiveCode development, training, and consulting services: Fourth World Systems
LiveCode Group on Facebook
LiveCode Group on LinkedIn

Post Reply