diff options
author | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-05-25 15:05:23 +0200 |
---|---|---|
committer | Bjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com> | 2018-05-25 15:05:23 +0200 |
commit | 7b9dbef41acfc619754d5a2a342a00e37f6f96e0 (patch) | |
tree | 6106d8da7f4686a4969c16aca67f74fba844df71 /docs/content/en/functions/cond.md | |
parent | 0bf0e1972df01cb3c5cff21b1accbbff55a6a475 (diff) | |
parent | d2b1030060d3c91d5f9ffa3456418da16bd74f1d (diff) |
Merge commit 'd2b1030060d3c91d5f9ffa3456418da16bd74f1d'
Diffstat (limited to 'docs/content/en/functions/cond.md')
-rw-r--r-- | docs/content/en/functions/cond.md | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/docs/content/en/functions/cond.md b/docs/content/en/functions/cond.md index 16c1f105f..72a9c0a9a 100644 --- a/docs/content/en/functions/cond.md +++ b/docs/content/en/functions/cond.md @@ -24,3 +24,9 @@ Example: ``` Would emit "goose" if the `$geese` array has exactly 1 item, or "geese" otherwise. + +{{% warning %}} +Whenever you use a `cond` function, *both* variable expressions are *always* evaluated. This means that a usage like `cond false (div 1 0) 27` will throw an error because `div 1 0` will be evaluated *even though the condition is false*. + +In other words, the `cond` function does *not* provide [short-circuit evaluation](https://en.wikipedia.org/wiki/Short-circuit_evaluation) and does *not* work like a normal [ternary operator](https://en.wikipedia.org/wiki/%3F:) that will pass over the first expression if the condition returns `false`. +{{% /warning %}}
\ No newline at end of file |