blob: 75051d690afd4cc4ce4c3e1d040809060ff3a99b [file] [log] [blame]
cue eval -i op.cue
cmp stdout expect-stdout-cue
-- frontmatter.toml --
title = "Operators"
description = ""
-- text.md --
CUE supports many common arithmetic and boolean operators.
The operators for division and remainder are different for `int` and `float`.
For `float` CUE supports the `/` and `%` operators with the usual meaning.
For `int` CUE supports both Euclidean division (`div` and `mod`)
and truncated division (`quo` and `rem`).
-- op.cue --
a: 3 / 2 // type float
b: 3 div 2 // type int: Euclidean division
c: 3 * "blah"
d: 3 * [1, 2, 3]
e: 8 < 10
-- expect-stdout-cue --
a: 1.5
b: 1
c: "blahblahblah"
d: [1, 2, 3, 1, 2, 3, 1, 2, 3]
e: true