1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

doc: document !in (#8546)

This commit is contained in:
Ruofan XU 2021-02-05 23:45:20 +08:00 committed by GitHub
parent 81789ee106
commit 12e8e31bb2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1046,15 +1046,18 @@ match mut x {
### In operator
`in` allows to check whether an array or a map contains an element.
To do the opposite, use `!in`.
```v
nums := [1, 2, 3]
println(1 in nums) // true
println(4 !in nums) // true
m := {
'one': 1
'two': 2
}
println('one' in m) // true
println('three' !in m) // true
```
It's also useful for writing boolean expressions that are clearer and more compact: