github.com/joomcode/cue@v0.4.4-0.20221111115225-539fe3512047/doc/tutorial/basics/6_expressions/10_operators.txt (about)

     1  cue eval -i op.cue
     2  cmp stdout expect-stdout-cue
     3  
     4  -- frontmatter.toml --
     5  title = "Operators"
     6  description = ""
     7  
     8  -- text.md --
     9  CUE supports many common arithmetic and boolean operators.
    10  
    11  The operators for division and remainder are different for `int` and `float`.
    12  For `float` CUE supports the `/` operator with the usual meaning.
    13  For `int` CUE supports both Euclidean division (`div` and `mod`)
    14  and truncated division (`quo` and `rem`).
    15  
    16  -- op.cue --
    17  a: 3 / 2   // type float
    18  b: 3 div 2 // type int: Euclidean division
    19  
    20  c: 3 * "blah"
    21  d: 3 * [1, 2, 3]
    22  
    23  e: 8 < 10
    24  
    25  -- expect-stdout-cue --
    26  a: 1.5
    27  b: 1
    28  c: "blahblahblah"
    29  d: [1, 2, 3, 1, 2, 3, 1, 2, 3]
    30  e: true