Skip to content

Commit 033abb4

Browse files
authored
note infix syntax for "in" and "∈" (#54091)
I noticed that the docstring for `in` did not mention the infix syntax up-front, making it easier to [be confused about the argument order](https://discourse.julialang.org/t/in-x-y-and-y-in-x-behave-differently/112965).
1 parent fda02ac commit 033abb4

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

base/operators.jl

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1382,11 +1382,15 @@ a function equivalent to `y -> item in y`.
13821382
13831383
Determine whether an item is in the given collection, in the sense that it is
13841384
[`==`](@ref) to one of the values generated by iterating over the collection.
1385+
Can equivalently be used with infix syntax:
1386+
1387+
item in collection
1388+
item ∈ collection
1389+
13851390
Return a `Bool` value, except if `item` is [`missing`](@ref) or `collection`
13861391
contains `missing` but not `item`, in which case `missing` is returned
13871392
([three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic),
13881393
matching the behavior of [`any`](@ref) and [`==`](@ref)).
1389-
13901394
Some collections follow a slightly different definition. For example,
13911395
[`Set`](@ref)s check whether the item [`isequal`](@ref) to one of the elements;
13921396
[`Dict`](@ref)s look for `key=>value` pairs, and the `key` is compared using

0 commit comments

Comments
 (0)