The merge function is redundant?

J. Landman Gay jacque at
Fri Jan 18 15:22:54 EST 2019

On 1/18/19 12:33 PM, kee nethery via use-livecode wrote:
> I’m confused. Can someone explain why merge function exists when the put function works just as well?
> merge( [[ 1 + 2 ]] = 3)
> vs
> put 1 + 2 && “= 3”
> What is it that merge can do that a put cannot do? 

For me, it's convenience, precision, and readability (no need for all 
those ampersands and quote marks.) I use it mostly for reports, 
auto-generated emails from my server, and sometimes dynamic HTML 
construction. It also eliminates the need for multiple "replace" commands.

For example, imagine a text template in a custom property named "cText":

Dear [[username]],
   Thank you for your interest in [[productname]]. [[productname]] is 
available for download at [[productURL]].

And the script:

put "John Doe" into username
put "Zygodact" into productname
put "" into productURL
put merge(the cText of me) into tResponse

Jacqueline Landman Gay         |     jacque at
HyperActive Software           |

More information about the Use-livecode mailing list