Add Values to a Sequence?

后端 未结 3 870
余生分开走
余生分开走 2021-02-05 04:01

I\'ve created a FreeMarker sequence in my template:

<#assign x = [\"red\", 16, \"blue\", \"cyan\"]>

How do I add additional values to the

3条回答
  •  死守一世寂寞
    2021-02-05 04:43

    Laurent's answer is correct and perfectly acceptable. But you can also add a value using shorthand:

    <#assign x += ["green"]>
    

    Now the sequence will look like:

    Sequence (5)
      0 = "red" (String)
      1 = 16 (BigDecimal)
      2 = "blue" (String)
      3 = "cyan" (String)
      4 = "green" (String)
    

提交回复
热议问题