Was this page helpful?

Concatenation Operators

    .. Operator (string)

    Concatenates two strings.  If the operands are not strings, they are converted to strings first.

    Usage Restrictions

    1.8.2 or later.

    Samples


    Output

    To concatenate two constant strings:

    {{ "Hello " .. "World!" }} 

    Hello World!

    To concatenate a string with a number:

    {{ "1+1=" .. 1+1 }}

    1+1=2

    .. Operator (list/map)

    Concatenate two lists or maps.  For lists, a new list is created by appending the right list to the left list.  For maps, a new map is created by first adding the key-value pairs from the left map and then from the right map.  If a key-value pair with the same key exists in both maps, then the one from the right map overwrites the one from the left map.  If either the left or right value is nil, the other value is returned instead.

    Usage Restrictions

    1.9.1 or later.

    Samples


    Output

    To combine two lists:

    {{ [ 1, 2, 3 ] .. [ 4, 5, 6 ] }}

    [ 1, 2, 3, 4, 5, 6 ]

    To combine two maps:

    {{ { a: 1 } .. { b: 2, c: 3 } }}

    { a : 1, b : 2, c : 3 }

     

    Was this page helpful?
    Tag page
    Viewing 2 of 2 comments: view all
    would the "new" % also be considered concatination operator?
    Posted 13:54, 11 Jun 2010
    @klumsy python calls it "string interpolation"
    Posted 15:48, 11 Jun 2010
    Viewing 2 of 2 comments: view all
    You must login to post a comment.

    Copyright © 2011 MindTouch, Inc. Powered by