Replacing GlobalNames with Global Values

Mark Wieder ahsoftware at sonic.net
Mon Feb 11 22:24:44 EST 2019


On 2/11/19 6:58 PM, Roger Guay via use-livecode wrote:
> Granted, this may be too esoteric for me to understand, but I can’t seem to make this do what I want to do
> 
> Let’s say that I have 3 globals: gGlobal1 = 10.1, gGlobal2 = 20.2 and gGlobal3 = 30.3
> 
> I have an expression like       gGlobal1*gGlobal2/gGlobal3
> 
> I want to transform this to the expression     10.1*20.2/30.3.
> 
> Seems simple enough and I can do it in my usual inelegant way, but there must be a simpler way to do this???
> 
> Sorry for my confusion.

Monte's reply seems to do the job, but if you're concerned about the 
numeric format, try

on mouseUp
    put 10.1 into gGlobal1
    put 20.2 into gGlobal2
    put 30.3 into gGlobal3
    put format("%2.1f*%2.1f/cos(%2.1f)", gGlobal1, gGlobal2, gGlobal3)
end mouseUp

or just chang that last line to
    put format("%s*%s/cos(%s)", gGlobal1, gGlobal2, gGlobal3)
if you *really* don't care about the format

-- 
  Mark Wieder
  ahsoftware at gmail.com




More information about the Use-livecode mailing list