github.com/lmorg/murex@v0.0.0-20240217211045-e081c89cd4ef/docs/parser/add-with.md (about)

     1  # `+=` Add With Operator
     2  
     3  > Adds the right hand value to a variable (expression)
     4  
     5  ## Description
     6  
     7  The Add With operator takes the value of the variable specified on the left
     8  side of the operator and adds it with the value on the right hand side. Then
     9  it assigns the result back to the variable specified on the left side.
    10  
    11  It is ostensibly just shorthand for `$i = $i + value`.
    12  
    13  This operator is only available in expressions.
    14  
    15  
    16  
    17  ## Examples
    18  
    19  ```
    20  » $i = 3
    21  » $i += 2
    22  » $i
    23  5
    24  ```
    25  
    26  ## Detail
    27  
    28  ### Strict Types
    29  
    30  Unlike with the standard arithmetic operators (`+`, `-`, `*`, `/`), silent data
    31  casting isn't supported with arithmetic assignments like `+=`, `-=`, `*=` and
    32  `/=`. Not even when `strict-types` is disabled.
    33  
    34  You can work around this by using the slightly longer syntax: **variable =
    35  value op value**, for example:
    36  
    37  ```
    38  » $i = "3"
    39  » $i = $i + "2"
    40  » $i
    41  5
    42  ```
    43  
    44  Please note that this behaviour might change in a later release of Murex.
    45  
    46  ## See Also
    47  
    48  * [`*=` Multiply By Operator](../parser/multiply-by.md):
    49    Multiplies a variable by the right hand value (expression)
    50  * [`+` Addition Operator](../parser/addition.md):
    51    Adds two numeric values together (expression)
    52  * [`-=` Subtract By Operator](../parser/subtract-by.md):
    53    Subtracts a variable by the right hand value (expression)
    54  * [`/=` Divide By Operator](../parser/divide-by.md):
    55    Divides a variable by the right hand value (expression)
    56  * [`cast`](../commands/cast.md):
    57    Alters the data type of the previous function without altering it's output
    58  * [`config`](../commands/config.md):
    59    Query or define Murex runtime settings
    60  * [`expr`](../commands/expr.md):
    61    Expressions: mathematical, string comparisons, logical operators
    62  * [`float` (floating point number)](../types/float.md):
    63    Floating point number (primitive)
    64  * [`int`](../types/int.md):
    65    Whole number (primitive)
    66  * [`num` (number)](../types/num.md):
    67    Floating point number (primitive)
    68  
    69  <hr/>
    70  
    71  This document was generated from [gen/expr/add_with_op_doc.yaml](https://github.com/lmorg/murex/blob/master/gen/expr/add_with_op_doc.yaml).