github.com/coveo/gotemplate@v2.7.7+incompatible/docs/doc_test/assignation.rendered (about)

     1  {% include navigation.html %}
     2  {% raw %}
     3  
     4  # Assignation
     5  
     6  ## Global variables
     7  
     8  | Razor expression                            | Go Template                                              | Note
     9  | ----------------                            | -----------                                              | ----
    10  | ``                | ``                   | Global assignation of string
    11  | ``                          | ``                             | Global assignation of integer
    12  | ``                        | ``                           | Global assignation of floating point
    13  | ``                        | ``                           | Global assignation of large scientific notation number
    14  | ``                        | ``                           | Global assignation of small scientific notation number
    15  | ``                          | ``                             | Global assignation of hexadecimal number
    16  | ``                      | ``               | Global assignation of mathematic expression
    17  | `` | `` | Global assignation of generic expression
    18  
    19  ## Local variables
    20  
    21  | Razor expression                             | Go Template                                        | Note
    22  | ----------------                             | -----------                                        | ----
    23  | ``                | ``                 | Local assignation of string
    24  | ``                          | ``                           | Local assignation of integer
    25  | ``                        | ``                         | Local assignation of floating point
    26  | ``                        | ``                         | Local assignation of large scientific number
    27  | ``                        | ``                         | Local assignation of small scientific number
    28  | ``                          | ``                           | Local assignation of hexadecimal number
    29  | ``                      | ``               | Local assignation of mathematic expression
    30  | `` | `` | Local assignation of generic expression
    31  
    32  ### Exception
    33  
    34  | Razor expression                                | Go Template                                        | Note
    35  | ----------------                                | -----------                                        | ----
    36  | ` "hello" "world" | upper`   | ` "hello" "world" | upper` | Using a mixup of go template expression and razor expression could lead to undesired result
    37  | ``     | ``   | Enclosing the whole assignation statement within {} ensures that the whole expression is assigned
    38  | ``    | ``   | Using that syntax give the exact same result
    39  
    40  ### Assignation within expression
    41  
    42  ```go
    43      1
    44      2
    45      3
    46      4
    47      5
    48      6
    49      7
    50      8
    51      9
    52      10
    53  ```
    54  
    55  ```go
    56      0 = 2
    57      1 = 4
    58      2 = 6
    59      3 = 8
    60      4 = 10
    61      5 = 12
    62      6 = 14
    63      7 = 16
    64      8 = 18
    65      9 = 20
    66  ```
    67  
    68  ```go
    69      result = true
    70  ```
    71  
    72  ```go
    73      value = 4
    74  ```
    75  
    76  {% endraw %}