mirror of
https://github.com/mikefarah/yq.git
synced 2026-07-10 16:55:40 +00:00
Remove duplicate number subtraction example
This commit is contained in:
parent
48f0badd66
commit
c14637b185
@ -59,24 +59,6 @@ a: -1.5
|
|||||||
b: 4.5
|
b: 4.5
|
||||||
```
|
```
|
||||||
|
|
||||||
## Number subtraction - float
|
|
||||||
If the lhs or rhs are floats then the expression will be calculated with floats.
|
|
||||||
|
|
||||||
Given a sample.yml file of:
|
|
||||||
```yaml
|
|
||||||
a: 3
|
|
||||||
b: 4.5
|
|
||||||
```
|
|
||||||
then
|
|
||||||
```bash
|
|
||||||
yq '.a = .a - .b' sample.yml
|
|
||||||
```
|
|
||||||
will output
|
|
||||||
```yaml
|
|
||||||
a: -1.5
|
|
||||||
b: 4.5
|
|
||||||
```
|
|
||||||
|
|
||||||
## Number subtraction - int
|
## Number subtraction - int
|
||||||
If both the lhs and rhs are ints then the expression will be calculated with ints.
|
If both the lhs and rhs are ints then the expression will be calculated with ints.
|
||||||
|
|
||||||
|
|||||||
@ -67,15 +67,6 @@ var subtractOperatorScenarios = []expressionScenario{
|
|||||||
"D0, P[], (doc)::{a: -1.5, b: 4.5}\n",
|
"D0, P[], (doc)::{a: -1.5, b: 4.5}\n",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
{
|
|
||||||
description: "Number subtraction - float",
|
|
||||||
subdescription: "If the lhs or rhs are floats then the expression will be calculated with floats.",
|
|
||||||
document: `{a: 3, b: 4.5}`,
|
|
||||||
expression: `.a = .a - .b`,
|
|
||||||
expected: []string{
|
|
||||||
"D0, P[], (doc)::{a: -1.5, b: 4.5}\n",
|
|
||||||
},
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
description: "Number subtraction - int",
|
description: "Number subtraction - int",
|
||||||
subdescription: "If both the lhs and rhs are ints then the expression will be calculated with ints.",
|
subdescription: "If both the lhs and rhs are ints then the expression will be calculated with ints.",
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user