The merge function is redundant?

Geoff Canyon gcanyon at gmail.com
Fri Jan 18 14:16:28 EST 2019


There's some overlap, but merge has (at least) one feature that put
doesn't: the ability to run code within its statement. A simple example:

    put merge("The coin came up <?if random(2) = 1 then return heads else
return tails?>.")

The equivalent might be:

    put "The coin came up" && item random(2) of "heads,tails" & "."

But consider this:

   put 10 into myVar
   put merge("The sum of the numbers from 1 to [[myVar]] is <?put 0 into
myTotal; repeat with i = 1 to myVar; add i to myTotal; end repeat; return
myTotal?>.")

There is no way to do that with a simple "put". You could unroll the code,
but for instances like what I'm planning to do with Navigator, that would
be totally unworkable.



More information about the use-livecode mailing list