## [System](#System)
Return `false` if the specified IO object is not writable.
**Examples**
```julia-repl
julia> open("myfile.txt", "w") do io
           print(io, "Hello world!");
           iswritable(io)
       end
true

julia> open("myfile.txt", "r") do io
           iswritable(io)
       end
false

julia> rm("myfile.txt")
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/io.jl#L159-L179)
```julia
Sys.username() -> String
```
Return the username for the current user. If the username cannot be determined or is empty, this function throws an error.
To retrieve a username that is overridable via an environment variable, e.g., `USER`, consider using
```julia
user = get(Sys.username, ENV, "USER")
```
This function requires at least Julia 1.11.
See also [`homedir`](../file/#Base.Filesystem.homedir).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L639-L655)
```julia
@static
```
Partially evaluate an expression at parse time.
For example, `@static Sys.iswindows() ? foo : bar` will evaluate `Sys.iswindows()` and insert either `foo` or `bar` into the expression. This is useful in cases where a construct would be invalid on other platforms, such as a `ccall` to a non-existent function. `@static if Sys.isapple() foo end` and `@static foo <&&,||> bar` are also valid syntax.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/osutils.jl#L3-L13)


## [Versioning](#Versioning)
```julia
VersionNumber
```
Version number type which follows the specifications of [semantic versioning (semver)](https://semver.org/), composed of major, minor and patch numeric values, followed by pre-release and build alphanumeric annotations.
`VersionNumber` objects can be compared with all of the standard comparison operators (`==`, `<`, `<=`, etc.), with the result following semver rules.
`VersionNumber` has the the following public fields:
-   `v.major::Integer`
-   `v.minor::Integer`
-   `v.patch::Integer`
-   `v.prerelease::Tuple{Vararg{Union{Integer, AbstractString}}}`
-   `v.build::Tuple{Vararg{Union{Integer, AbstractString}}}`
See also [`@v_str`](#Base.@v_str) to efficiently construct `VersionNumber` objects from semver-format literal strings, [`VERSION`](../constants/#Base.VERSION) for the `VersionNumber` of Julia itself, and [Version Number Literals](../../manual/strings/#man-version-number-literals) in the manual.
**Examples**
```julia-repl
julia> a = VersionNumber(1, 2, 3)
v"1.2.3"

julia> a >= v"1.2"
true

julia> b = VersionNumber("2.0.1-rc1")
v"2.0.1-rc1"

julia> b >= v"2.0.1"
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/version.jl#L8-L45)
```julia
@v_str
```
String macro used to parse a string to a [`VersionNumber`](#Base.VersionNumber).
**Examples**
```julia-repl
julia> v"1.2.3"
v"1.2.3"

julia> v"2.0.1-rc1"
v"2.0.1-rc1"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/version.jl#L154-L167)


## [Errors](#Errors)
```julia
error(message::AbstractString)
```
Raise an `ErrorException` with the given message.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L30-L34)
```julia
error(msg...)
```
Raise an `ErrorException` with a message constructed by `string(msg...)`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L37-L41)
```julia
throw(e)
```
Throw an object as an exception.
See also: [`rethrow`](#Base.rethrow), [`error`](#Base.error).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L19-L25)
```julia
rethrow()
```
Rethrow the current exception from within a `catch` block. The rethrown exception will continue propagation as if it had not been caught.
The alternative form `rethrow(e)` allows you to associate an alternative exception object `e` with the current backtrace. However this misrepresents the program state at the time of the error so you're encouraged to instead throw a new exception using `throw(e)`. In Julia 1.1 and above, using `throw(e)` will preserve the root cause exception on the stack, as described in [`current_exceptions`](#Base.current_exceptions).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L47-L60)
```julia
backtrace()
```
Get a backtrace object for the current program point.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L104-L108)
```julia
catch_backtrace()
```


## [Errors](#Errors)
Get the backtrace of the current exception, for use within `catch` blocks.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L118-L122)
```julia
current_exceptions(task::Task=current_task(); [backtrace::Bool=true])
```
Get the stack of exceptions currently being handled. For nested catch blocks there may be more than one current exception in which case the most recently thrown exception is last in the stack. The stack is returned as an `ExceptionStack` which is an AbstractVector of named tuples `(exception,backtrace)`. If `backtrace` is false, the backtrace in each pair will be set to `nothing`.
Explicitly passing `task` will return the current exception stack on an arbitrary task. This is useful for inspecting tasks which have failed due to uncaught exceptions.
This function went by the experimental name `catch_stack()` in Julia 1.1–1.6, and had a plain Vector-of-tuples as a return type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L132-L149)
```julia
@assert cond [text]
```
Throw an [`AssertionError`](#Core.AssertionError) if `cond` is `false`. This is the preferred syntax for writing assertions, which are conditions that are assumed to be true, but that the user might decide to check anyways, as an aid to debugging if they fail. The optional message `text` is displayed upon assertion failure.


## [Errors](#Errors)
An assert might be disabled at some optimization levels. Assert should therefore only be used as a debugging tool and not used for authentication verification (e.g., verifying passwords or checking array bounds). The code must not rely on the side effects of running `cond` for the correct behavior of a function.
**Examples**
```julia-repl
julia> @assert iseven(3) "3 is an odd number!"
ERROR: AssertionError: 3 is an odd number!

julia> @assert isodd(3) "What even are numbers?"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L197-L219)
```julia
Experimental.register_error_hint(handler, exceptiontype)
```
Register a "hinting" function `handler(io, exception)` that can suggest potential ways for users to circumvent errors. `handler` should examine `exception` to see whether the conditions appropriate for a hint are met, and if so generate output to `io`. Packages should call `register_error_hint` from within their `__init__` function.
For specific exception types, `handler` is required to accept additional arguments:
-   `MethodError`: provide `handler(io, exc::MethodError, argtypes, kwargs)`, which splits the combined arguments into positional and keyword arguments.
When issuing a hint, the output should typically start with `\n`.
If you define custom exception types, your `showerror` method can support hints by calling [`Experimental.show_error_hints`](#Base.Experimental.show_error_hints).
**Examples**


## [Errors](#Errors)
```julia
julia> module Hinter

       only_int(x::Int)      = 1
       any_number(x::Number) = 2

       function __init__()
           Base.Experimental.register_error_hint(MethodError) do io, exc, argtypes, kwargs
               if exc.f == only_int
                    # Color is not necessary, this is just to show it's possible.
                    print(io, "\nDid you mean to call ")
                    printstyled(io, "`any_number`?", color=:cyan)
               end
           end
       end

       end
```
Then if you call `Hinter.only_int` on something that isn't an `Int` (thereby triggering a `MethodError`), it issues the hint:
```julia
julia> Hinter.only_int(1.0)
ERROR: MethodError: no method matching only_int(::Float64)
The function `only_int` exists, but no method is defined for this combination of argument types.
Did you mean to call `any_number`?
Closest candidates are:
    ...
```
Custom error hints are available as of Julia 1.5.
This interface is experimental and subject to change or removal without notice. To insulate yourself against changes, consider putting any registrations inside an `if isdefined(Base.Experimental, :register_error_hint) ... end` block.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/experimental.jl#L237-L295)
```julia
Experimental.show_error_hints(io, ex, args...)
```


## [Errors](#Errors)
Invoke all handlers from [`Experimental.register_error_hint`](#Base.Experimental.register_error_hint) for the particular exception type `typeof(ex)`. `args` must contain any other arguments expected by the handler for that type.
Custom error hints are available as of Julia 1.5.
This interface is experimental and subject to change or removal without notice.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/experimental.jl#L304-L315)
```julia
ArgumentError(msg)
```
The arguments passed to a function are invalid. `msg` is a descriptive error message.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3083-L3088)
```julia
AssertionError([msg])
```
The asserted condition did not evaluate to `true`. Optional argument `msg` is a descriptive error string.
**Examples**
```julia-repl
julia> @assert false "this is not true"
ERROR: AssertionError: this is not true
```
`AssertionError` is usually thrown from [`@assert`](#Base.@assert).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3099-L3112)
```julia
BoundsError([a],[i])
```
An indexing operation into an array, `a`, tried to access an out-of-bounds element at index `i`.
**Examples**


## [Errors](#Errors)
```julia-repl
julia> A = fill(1.0, 7);

julia> A[8]
ERROR: BoundsError: attempt to access 7-element Vector{Float64} at index [8]

julia> B = fill(1.0, (2,3));

julia> B[2, 4]
ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [2, 4]

julia> B[9]
ERROR: BoundsError: attempt to access 2×3 Matrix{Float64} at index [9]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1728-L1751)
```julia
CompositeException
```
Wrap a `Vector` of exceptions thrown by a [`Task`](../parallel/#Core.Task) (e.g. generated from a remote worker over a channel or an asynchronously executing local I/O write or a remote worker under `pmap`) with information about the series of exceptions. For example, if a group of workers are executing several tasks, and multiple workers fail, the resulting `CompositeException` will contain a "bundle" of information from each worker indicating where and why the exception(s) occurred.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/task.jl#L38-L45)
```julia
DimensionMismatch([msg])
```
The objects called do not have matching dimensionality. Optional argument `msg` is a descriptive error string.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L5-L10)
```julia
DivideError()
```
Integer division was attempted with a denominator value of 0.
**Examples**
```julia-repl
julia> 2/0
Inf

julia> div(2, 0)
ERROR: DivideError: integer division error
Stacktrace:
[...]
```


## [Errors](#Errors)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2017-L2032)
```julia
DomainError(val)
DomainError(val, msg)
```
The argument `val` to a function or constructor is outside the valid domain.
**Examples**
```julia-repl
julia> sqrt(-1)
ERROR: DomainError with -1.0:
sqrt was called with a negative real argument but will only return a complex result if called with a complex argument. Try sqrt(Complex(x)).
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1769-L1783)
```julia
EOFError()
```
No more data was available to read from a file or stream.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/io.jl#L5-L9)
```julia
ErrorException(msg)
```
Generic error type. The error message, in the `.msg` field, may provide more specific details.
**Examples**
```julia-repl
julia> ex = ErrorException("I've done a bad thing");

julia> ex.msg
"I've done a bad thing"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1635-L1647)
```julia
InexactError(name::Symbol, T, val)
```
Cannot exactly convert `val` to type `T` in a method of function `name`.
**Examples**
```julia-repl
julia> convert(Float64, 1+2im)
ERROR: InexactError: Float64(1 + 2im)
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1754-L1766)
```julia
InterruptException()
```


## [Errors](#Errors)
The process was stopped by a terminal interrupt (CTRL+C).
Note that, in Julia script started without `-i` (interactive) option, `InterruptException` is not thrown by default. Calling [`Base.exit_on_sigint(false)`](../c/#Base.exit_on_sigint) in the script can recover the behavior of the REPL. Alternatively, a Julia script can be started with
```sh
julia -e "include(popfirst!(ARGS))" script.jl
```
to let `InterruptException` be thrown by CTRL+C during the execution.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1902-L1918)
```julia
KeyError(key)
```
An indexing operation into an `AbstractDict` (`Dict`) or `Set` like object tried to access or delete a non-existent element.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/abstractdict.jl#L5-L10)
```julia
LoadError(file::AbstractString, line::Int, error)
```
An error occurred while [`include`](#Base.include)ing, [`require`](#Base.require)ing, or [`using`](#using) a file. The error specifics should be available in the `.error` field.
LoadErrors are no longer emitted by `@macroexpand`, `@macroexpand1`, and `macroexpand` as of Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3115-L3123)
```julia
MethodError(f, args)
```
A method with the required type signature does not exist in the given generic function. Alternatively, there is no unique most-specific method.


## [Errors](#Errors)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3091-L3096)
```julia
MissingException(msg)
```
Exception thrown when a [`missing`](../../manual/missing/#missing) value is encountered in a situation where it is not supported. The error message, in the `msg` field may provide more specific details.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/missing.jl#L7-L13)
```julia
OutOfMemoryError()
```
An operation allocated too much memory for either the system or the garbage collector to handle properly.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1720-L1725)
```julia
ReadOnlyMemoryError()
```
An operation tried to write to memory that is read-only.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1628-L1632)
```julia
OverflowError(msg)
```
The result of an expression is too large for the specified type and will cause a wraparound.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1888-L1892)
```julia
ProcessFailedException
```
Indicates problematic exit status of a process. When running commands or pipelines, this is thrown to indicate a nonzero exit code was returned (i.e. that the invoked process failed).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/process.jl#L572-L578)
```julia
TaskFailedException
```


## [Errors](#Errors)
This exception is thrown by a [`wait(t)`](../parallel/#Base.wait) call when task `t` fails. `TaskFailedException` wraps the failed task `t`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/task.jl#L70-L75)
```julia
StackOverflowError()
```
The function call grew beyond the size of the call stack. This usually happens when a call recurses infinitely.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1811-L1816)
```julia
SystemError(prefix::AbstractString, [errno::Int32])
```
A system call failed with an error code (in the `errno` global variable).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/io.jl#L12-L16)
```julia
TypeError(func::Symbol, context::AbstractString, expected::Type, got)
```
A type assertion failure, or calling an intrinsic function with an incorrect argument type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1895-L1899)
```julia
UndefKeywordError(var::Symbol)
```
The required keyword argument `var` was not assigned in a function call.
**Examples**
```julia-repl
julia> function my_func(;my_arg)
           return my_arg + 1
       end
my_func (generic function with 1 method)

julia> my_func()
ERROR: UndefKeywordError: keyword argument `my_arg` not assigned
Stacktrace:
 [1] my_func() at ./REPL[1]:2
 [2] top-level scope at REPL[2]:1
```


## [Errors](#Errors)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1867-L1885)
```julia
UndefRefError()
```
The item or field is not defined for the given object.
**Examples**
```julia-repl
julia> struct MyType
           a::Vector{Int}
           MyType() = new()
       end

julia> A = MyType()
MyType(#undef)

julia> A.a
ERROR: UndefRefError: access to undefined reference
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1659-L1679)
```julia
UndefVarError(var::Symbol, [scope])
```
A symbol in the current scope is not defined.
**Examples**
```julia-repl
julia> a
ERROR: UndefVarError: `a` not defined in `Main`

julia> a = 1;

julia> a
1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1849-L1864)
```julia
StringIndexError(str, i)
```
An error occurred when trying to access `str` at index `i` that is not valid.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/strings/string.jl#L3-L7)
```julia
InitError(mod::Symbol, error)
```
An error occurred when running a module's `__init__` function. The actual error thrown is available in the `.error` field.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3126-L3131)
```julia
retry(f;  delays=ExponentialBackOff(), check=nothing) -> Function
```


## [Errors](#Errors)
Return an anonymous function that calls function `f`. If an exception arises, `f` is repeatedly called again, each time `check` returns `true`, after waiting the number of seconds specified in `delays`. `check` should input `delays`'s current state and the `Exception`.
Before Julia 1.2 this signature was restricted to `f::Function`.
**Examples**
```julia
retry(f, delays=fill(5.0, 3))
retry(f, delays=rand(5:10, 2))
retry(f, delays=Base.ExponentialBackOff(n=3, first_delay=5, max_delay=1000))
retry(http_get, check=(s,e)->e.status == "503")(url)
retry(read, check=(s,e)->isa(e, IOError))(io, 128; all=false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L274-L293)
```julia
ExponentialBackOff(; n=1, first_delay=0.05, max_delay=10.0, factor=5.0, jitter=0.1)
```
A [`Float64`](../numbers/#Core.Float64) iterator of length `n` whose elements exponentially increase at a rate in the interval `factor` \* (1 ± `jitter`). The first element is `first_delay` and all elements are clamped to `max_delay`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/error.jl#L255-L261)


## [Events](#Events)
```julia
Timer(callback::Function, delay; interval = 0)
```
Create a timer that runs the function `callback` at each timer expiration.
Waiting tasks are woken and the function `callback` is called after an initial delay of `delay` seconds, and then repeating with the given `interval` in seconds. If `interval` is equal to `0`, the callback is only run once. The function `callback` is called with a single argument, the timer itself. Stop a timer by calling `close`. The `callback` may still be run one final time, if the timer has already expired.
**Examples**
Here the first number is printed after a delay of two seconds, then the following numbers are printed quickly.
```julia-repl
julia> begin
           i = 0
           cb(timer) = (global i += 1; println(i))
           t = Timer(cb, 2, interval=0.2)
           wait(t)
           sleep(0.5)
           close(t)
       end
1
2
3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/asyncevent.jl#L277-L306)
```julia
Timer(delay; interval = 0)
```
Create a timer that wakes up tasks waiting for it (by calling [`wait`](../parallel/#Base.wait) on the timer object).
Waiting tasks are woken after an initial delay of at least `delay` seconds, and then repeating after at least `interval` seconds again elapse. If `interval` is equal to `0`, the timer is only triggered once. When the timer is closed (by [`close`](../io-network/#Base.close)) waiting tasks are woken with an error. Use [`isopen`](../io-network/#Base.isopen) to check whether a timer is still active.


## [Events](#Events)
`interval` is subject to accumulating time skew. If you need precise events at a particular absolute time, create a new timer at each expiration with the difference to the next time computed.
A `Timer` requires yield points to update its state. For instance, `isopen(t::Timer)` cannot be used to timeout a non-yielding while loop.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/asyncevent.jl#L69-L87)
```julia
AsyncCondition()
```
Create a async condition that wakes up tasks waiting for it (by calling [`wait`](../parallel/#Base.wait) on the object) when notified from C by a call to `uv_async_send`. Waiting tasks are woken with an error when the object is closed (by [`close`](../io-network/#Base.close)). Use [`isopen`](../io-network/#Base.isopen) to check whether it is still active.
This provides an implicit acquire & release memory ordering between the sending and waiting threads.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/asyncevent.jl#L5-L15)
```julia
AsyncCondition(callback::Function)
```
Create a async condition that calls the given `callback` function. The `callback` is passed one argument, the async condition object itself.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/asyncevent.jl#L40-L45)


## [Reflection](#Reflection)
```julia
nameof(m::Module) -> Symbol
```
Get the name of a `Module` as a [`Symbol`](#Core.Symbol).
**Examples**
```julia-repl
julia> nameof(Base.Broadcast)
:Broadcast
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L183-L193)
```julia
parentmodule(m::Module) -> Module
```
Get a module's enclosing `Module`. `Main` is its own parent.
See also: [`names`](#Base.names), [`nameof`](#Base.nameof-Tuple%7BDataType%7D), [`fullname`](#Base.fullname), [`@__MODULE__`](#Base.@__MODULE__).
**Examples**
```julia-repl
julia> parentmodule(Main)
Main

julia> parentmodule(Base.Broadcast)
Base
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L5-L20)
```julia
parentmodule(t::DataType) -> Module
```
Determine the module containing the definition of a (potentially `UnionAll`-wrapped) `DataType`.
**Examples**
```julia-repl
julia> module Foo
           struct Int end
       end
Foo

julia> parentmodule(Int)
Core

julia> parentmodule(Foo.Int)
Foo
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L304-L322)
```julia
parentmodule(f::Function) -> Module
```
Determine the module containing the (first) definition of a generic function.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2278-L2283)
```julia
parentmodule(f::Function, types) -> Module
```


## [Reflection](#Reflection)
Determine the module containing the first method of a generic function `f` matching the specified `types`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2286-L2291)
```julia
parentmodule(m::Method) -> Module
```
Return the module in which the given method `m` is defined.
Passing a `Method` as an argument requires Julia 1.9 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2300-L2307)
```julia
pathof(m::Module)
```
Return the path of the `m.jl` file that was used to `import` module `m`, or `nothing` if `m` was not imported from a package.
Use [`dirname`](../file/#Base.Filesystem.dirname) to get the directory part and [`basename`](../file/#Base.Filesystem.basename) to get the file name part of the path.
See also [`pkgdir`](#Base.pkgdir-Tuple%7BModule%7D).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L513-L523)
```julia
pkgdir(m::Module[, paths::String...])
```
Return the root directory of the package that declared module `m`, or `nothing` if `m` was not declared in a package. Optionally further path component strings can be provided to construct a path within the package root.
To get the root directory of the package that implements the current module the form `pkgdir(@__MODULE__)` can be used.
If an extension module is given, the root of the parent package is returned.


## [Reflection](#Reflection)
```julia-repl
julia> pkgdir(Foo)
"/path/to/Foo.jl"

julia> pkgdir(Foo, "src", "file.jl")
"/path/to/Foo.jl/src/file.jl"
```
See also [`pathof`](#Base.pathof-Tuple%7BModule%7D).
The optional argument `paths` requires at least Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L536-L561)
```julia
pkgversion(m::Module)
```
Return the version of the package that imported module `m`, or `nothing` if `m` was not imported from a package, or imported from a package without a version field set.
The version is read from the package's Project.toml during package load.
To get the version of the package that imported the current module the form `pkgversion(@__MODULE__)` can be used.
This function was introduced in Julia 1.9.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L593-L608)
```julia
moduleroot(m::Module) -> Module
```
Find the root module of a given module. This is the first module in the chain of parent modules of `m` which is either a registered root module or which is its own parent module.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L23-L29)
```julia
__module__
```
The argument `__module__` is only visible inside the macro, and it provides information (in the form of a `Module` object) about the expansion context of the macro invocation. See the manual section on [Macro invocation](../../manual/metaprogramming/#Macro-invocation) for more information.


## [Reflection](#Reflection)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L260-L266)
```julia
__source__
```
The argument `__source__` is only visible inside the macro, and it provides information (in the form of a `LineNumberNode` object) about the parser location of the `@` sign from the macro invocation. See the manual section on [Macro invocation](../../manual/metaprogramming/#Macro-invocation) for more information.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L269-L275)
```julia
@__MODULE__ -> Module
```
Get the `Module` of the toplevel eval, which is the `Module` code is currently being read from.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L39-L44)
```julia
@__FILE__ -> String
```
Expand to a string with the path to the file containing the macrocall, or an empty string if evaluated by `julia -e <expr>`. Return `nothing` if the macro was missing parser source information. Alternatively see [`PROGRAM_FILE`](../constants/#Base.PROGRAM_FILE).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L3961-L3968)
```julia
@__DIR__ -> String
```
Macro to obtain the absolute path of the current directory as a string.
If in a script, returns the directory of the script containing the `@__DIR__` macrocall. If run from a REPL or if evaluated by `julia -e <expr>`, returns the current working directory.
**Examples**


## [Reflection](#Reflection)
The example illustrates the difference in the behaviors of `@__DIR__` and `pwd()`, by creating a simple script in a different directory than the current working one and executing both commands:
```julia-repl
julia> cd("/home/JuliaUser") # working directory

julia> # create script at /home/JuliaUser/Projects
       open("/home/JuliaUser/Projects/test.jl","w") do io
           print(io, """
               println("@__DIR__ = ", @__DIR__)
               println("pwd() = ", pwd())
           """)
       end

julia> # outputs script directory and current working directory
       include("/home/JuliaUser/Projects/test.jl")
@__DIR__ = /home/JuliaUser/Projects
pwd() = /home/JuliaUser
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L3974-L4003)
```julia
@__LINE__ -> Int
```
Expand to the line number of the location of the macrocall. Return `0` if the line number could not be determined.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1204-L1209)
```julia
fullname(m::Module)
```
Get the fully-qualified name of a module as a tuple of symbols. For example,
**Examples**
```julia-repl
julia> fullname(Base.Iterators)
(:Base, :Iterators)

julia> fullname(Main)
(:Main,)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L49-L62)
```julia
names(x::Module; all::Bool = false, imported::Bool = false)
```


## [Reflection](#Reflection)
Get a vector of the public names of a `Module`, excluding deprecated names. If `all` is true, then the list also includes non-public names defined in the module, deprecated names, and compiler-generated names. If `imported` is true, then names explicitly imported from other modules are also included. Names are returned in sorted order.
As a special case, all names defined in `Main` are considered "public", since it is not idiomatic to explicitly mark names from `Main` as public.
`sym ∈ names(SomeModule)` does *not* imply `isdefined(SomeModule, sym)`. `names` will return symbols marked with `public` or `export`, even if they are not defined in the module.
See also: [`Base.isexported`](#Base.isexported), [`Base.ispublic`](#Base.ispublic), [`Base.@locals`](#Base.@locals), [`@__MODULE__`](#Base.@__MODULE__).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L75-L93)
```julia
isexported(m::Module, s::Symbol) -> Bool
```
Returns whether a symbol is exported from a module.
See also: [`ispublic`](#Base.ispublic), [`names`](#Base.names)
```julia-repl
julia> module Mod
           export foo
           public bar
       end
Mod

julia> Base.isexported(Mod, :foo)
true

julia> Base.isexported(Mod, :bar)
false

julia> Base.isexported(Mod, :baz)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L99-L122)
```julia
ispublic(m::Module, s::Symbol) -> Bool
```
Returns whether a symbol is marked as public in a module.


## [Reflection](#Reflection)
Exported symbols are considered public.
This function and the notion of publicity were added in Julia 1.11.
See also: [`isexported`](#Base.isexported), [`names`](#Base.names)
```julia-repl
julia> module Mod
           export foo
           public bar
       end
Mod

julia> Base.ispublic(Mod, :foo)
true

julia> Base.ispublic(Mod, :bar)
true

julia> Base.ispublic(Mod, :baz)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L125-L153)
```julia
nameof(f::Function) -> Symbol
```
Get the name of a generic `Function` as a symbol. For anonymous functions, this is a compiler-generated name. For explicitly-declared subtypes of `Function`, it is the name of the function's type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2256-L2262)
```julia
functionloc(f::Function, types)
```
Return a tuple `(filename,line)` giving the location of a generic `Function` definition.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/methodshow.jl#L174-L178)
```julia
functionloc(m::Method)
```
Return a tuple `(filename,line)` giving the location of a `Method` definition.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/methodshow.jl#L161-L165)
```julia
@locals()
```
Construct a dictionary of the names (as symbols) and values of all local variables defined as of the call site.
This macro requires at least Julia 1.1.
**Examples**


## [Reflection](#Reflection)
```julia-repl
julia> let x = 1, y = 2
           Base.@locals
       end
Dict{Symbol, Any} with 2 entries:
  :y => 2
  :x => 1

julia> function f(x)
           local y
           show(Base.@locals); println()
           for i = 1:1
               show(Base.@locals); println()
           end
           y = 2
           show(Base.@locals); println()
           nothing
       end;

julia> f(42)
Dict{Symbol, Any}(:x => 42)
Dict{Symbol, Any}(:i => 1, :x => 42)
Dict{Symbol, Any}(:y => 2, :x => 42)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L386-L420)
```julia
getglobal(module::Module, name::Symbol, [order::Symbol=:monotonic])
```
Retrieve the value of the binding `name` from the module `module`. Optionally, an atomic ordering can be defined for the operation, otherwise it defaults to monotonic.
While accessing module bindings using [`getfield`](#Core.getfield) is still supported to maintain compatibility, using `getglobal` should always be preferred since `getglobal` allows for control over atomic ordering (`getfield` is always monotonic) and better signifies the code's intent both to the user as well as the compiler.
Most users should not have to call this function directly – The [`getproperty`](#Base.getproperty) function or corresponding syntax (i.e. `module.name`) should be preferred in all but few very specific use cases.
This function requires Julia 1.9 or later.
See also [`getproperty`](#Base.getproperty) and [`setglobal!`](#Core.setglobal!).
**Examples**


## [Reflection](#Reflection)
```julia-repl
julia> a = 1
1

julia> module M
       a = 2
       end;

julia> getglobal(@__MODULE__, :a)
1

julia> getglobal(M, :a)
2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2459-L2496)
```julia
setglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])
```
Set or change the value of the binding `name` in the module `module` to `x`. No type conversion is performed, so if a type has already been declared for the binding, `x` must be of appropriate type or an error is thrown.
Additionally, an atomic ordering can be specified for this operation, otherwise it defaults to monotonic.
Users will typically access this functionality through the [`setproperty!`](#Base.setproperty!) function or corresponding syntax (i.e. `module.name = x`) instead, so this is intended only for very specific use cases.
This function requires Julia 1.9 or later.
See also [`setproperty!`](#Base.setproperty!) and [`getglobal`](#Core.getglobal)
**Examples**
```julia-repl
julia> module M; global a; end;

julia> M.a  # same as `getglobal(M, :a)`
ERROR: UndefVarError: `a` not defined in `M`
Suggestion: add an appropriate import or assignment. This global was declared but not assigned.
Stacktrace:
 [1] getproperty(x::Module, f::Symbol)
   @ Base ./Base.jl:42
 [2] top-level scope
   @ none:1

julia> setglobal!(M, :a, 1)
1

julia> M.a
1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2500-L2539)


## [Reflection](#Reflection)
```julia
modifyglobal!(module::Module, name::Symbol, op, x, [order::Symbol=:monotonic]) -> Pair
```
Atomically perform the operations to get and set a global after applying the function `op`.
This function requires Julia 1.11 or later.
See also [`modifyproperty!`](#Base.modifyproperty!) and [`setglobal!`](#Core.setglobal!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2576-L2586)
```julia
swapglobal!(module::Module, name::Symbol, x, [order::Symbol=:monotonic])
```
Atomically perform the operations to simultaneously get and set a global.
This function requires Julia 1.11 or later.
See also [`swapproperty!`](#Base.swapproperty!) and [`setglobal!`](#Core.setglobal!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2564-L2573)
```julia
setglobalonce!(module::Module, name::Symbol, value,
              [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool
```
Atomically perform the operations to set a global to a given value, only if it was previously not set.
This function requires Julia 1.11 or later.
See also [`setpropertyonce!`](#Base.setpropertyonce!) and [`setglobal!`](#Core.setglobal!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2603-L2614)
```julia
replaceglobal!(module::Module, name::Symbol, expected, desired,
              [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
```


## [Reflection](#Reflection)
Atomically perform the operations to get and conditionally set a global to a given value.
This function requires Julia 1.11 or later.
See also [`replaceproperty!`](#Base.replaceproperty!) and [`setglobal!`](#Core.setglobal!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2589-L2600)


## [Documentation](#Documentation)
(See also the [documentation](../../manual/documentation/#man-documentation) chapter.)
**Documentation**
Functions, methods and types can be documented by placing a string before the definition:
```julia
"""
# The Foo Function
`foo(x)`: Foo the living hell out of `x`.
"""
foo(x) = ...
```
The `@doc` macro can be used directly to both set and retrieve documentation / metadata. The macro has special parsing so that the documented object may occur on the next line:
```julia
@doc "blah"
function foo() ...
```
By default, documentation is written as Markdown, but any object can be used as the first argument.
**Documenting objects separately from their definitions**
You can document an object before or after its definition with
```julia
@doc "foo" function_to_doc
@doc "bar" TypeToDoc
```
For macros, the syntax is `@doc "macro doc" :(Module.@macro)` or `@doc "macro doc" :(string_macro"")` for string macros. Without the quote `:()` the expansion of the macro will be documented.
**Retrieving Documentation**
You can retrieve docs for functions, macros and other objects as follows:
```julia
@doc foo
@doc @time
@doc md""
```
**Functions & Methods**
Placing documentation before a method definition (e.g. `function foo() ...` or `foo() = ...`) will cause that specific method to be documented, as opposed to the whole function. Method docs are concatenated together in the order they were defined to provide docs for the function.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/Docs.jl#L16-L58)


## [Documentation](#Documentation)
`HTML(s)`: Create an object that renders `s` as html.
```julia
HTML("<div>foo</div>")
```
You can also use a stream for large amounts of data:
```julia
HTML() do io
  println(io, "<div>foo</div>")
end
```
`HTML` is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as [`Docs.HTML`](#Base.Docs.HTML) or to explicitly import it from `Docs`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/utils.jl#L11-L28)
`Text(s)`: Create an object that renders `s` as plain text.
```julia
Text("foo")
```
You can also use a stream for large amounts of data:
```julia
Text() do io
  println(io, "foo")
end
```
`Text` is currently exported to maintain backwards compatibility, but this export is deprecated. It is recommended to use this type as [`Docs.Text`](#Base.Docs.Text) or to explicitly import it from `Docs`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/utils.jl#L69-L86)
```julia
Docs.hasdoc(mod::Module, sym::Symbol)::Bool
```
Return `true` if `sym` in `mod` has a docstring and `false` otherwise.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/Docs.jl#L711-L715)
```julia
undocumented_names(mod::Module; private=false)
```


## [Documentation](#Documentation)
Return a sorted vector of undocumented symbols in `module` (that is, lacking docstrings). `private=false` (the default) returns only identifiers declared with `public` and/or `export`, whereas `private=true` returns all symbols in the module (excluding compiler-generated hidden symbols starting with `#`).
See also: [`names`](#Base.names), [`Docs.hasdoc`](#Base.Docs.hasdoc), [`Base.ispublic`](#Base.ispublic).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/Docs.jl#L730-L739)


## [Code loading](#Code-loading)
```julia
Base.identify_package(name::String)::Union{PkgId, Nothing}
Base.identify_package(where::Union{Module,PkgId}, name::String)::Union{PkgId, Nothing}
```
Identify the package by its name from the current environment stack, returning its `PkgId`, or `nothing` if it cannot be found.
If only the `name` argument is provided, it searches each environment in the stack and its named direct dependencies.
The `where` argument provides the context from where to search for the package: in this case it first checks if the name matches the context itself, otherwise it searches all recursive dependencies (from the resolved manifest of each environment) until it locates the context `where`, and from there identifies the dependency with the corresponding name.
```julia-repl
julia> Base.identify_package("Pkg") # Pkg is a dependency of the default environment
Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f]

julia> using LinearAlgebra

julia> Base.identify_package(LinearAlgebra, "Pkg") # Pkg is not a dependency of LinearAlgebra
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L405-L429)
```julia
Base.locate_package(pkg::PkgId)::Union{String, Nothing}
```
The path to the entry-point file for the package corresponding to the identifier `pkg`, or `nothing` if not found. See also [`identify_package`](#Base.identify_package).
```julia-repl
julia> pkg = Base.identify_package("Pkg")
Pkg [44cfe95a-1eb2-52ea-b672-e2afdf69b78f]

julia> Base.locate_package(pkg)
"/path/to/julia/stdlib/v1.11/Pkg/src/Pkg.jl"
```


## [Code loading](#Code-loading)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L495-L508)
```julia
require(into::Module, module::Symbol)
```
This function is part of the implementation of [`using`](#using) / [`import`](#import), if a module is not already defined in `Main`. It can also be called directly to force reloading a module, regardless of whether it has been loaded before (for example, when interactively developing libraries).
Loads a source file, in the context of the `Main` module, on every active node, searching standard locations for files. `require` is considered a top-level operation, so it sets the current `include` path but does not use it to search for files (see help for [`include`](#Base.include)). This function is typically used to load library code, and is implicitly called by `using` to load packages.
When searching for files, `require` first looks for package code in the global array [`LOAD_PATH`](../constants/#Base.LOAD_PATH). `require` is case-sensitive on all platforms, including those with case-insensitive filesystems like macOS and Windows.
For more details regarding code loading, see the manual sections on [modules](../../manual/modules/#modules) and [parallel computing](../../manual/distributed-computing/#code-availability).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L2237-L2257)
```julia
Base.compilecache(module::PkgId)
```


## [Code loading](#Code-loading)
Creates a precompiled cache file for a module and all of its dependencies. This can be used to reduce package load times. Cache files are stored in `DEPOT_PATH[1]/compiled`. See [Module initialization and precompilation](../../manual/modules/#Module-initialization-and-precompilation) for important notes.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L3021-L3028)
```julia
Base.isprecompiled(pkg::PkgId; ignore_loaded::Bool=false)
```
Returns whether a given PkgId within the active project is precompiled.
By default this check observes the same approach that code loading takes with respect to when different versions of dependencies are currently loaded to that which is expected. To ignore loaded modules and answer as if in a fresh julia session specify `ignore_loaded=true`.
This function requires at least Julia 1.10.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L1820-L1832)
```julia
get_extension(parent::Module, extension::Symbol)
```
Return the module for `extension` of `parent` or return `nothing` if the extension is not loaded.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L1605-L1609)


## [Internals](#Internals)
```julia
GC.gc([full=true])
```
Perform garbage collection. The argument `full` determines the kind of collection: a full collection (default) traverses all live objects (i.e. full mark) and should reclaim memory from all unreachable objects. An incremental collection only reclaims memory from young objects which are not reachable.
The GC may decide to perform a full collection even if an incremental collection was requested.
Excessive use will likely lead to poor performance.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L119-L132)
```julia
GC.enable(on::Bool)
```
Control whether garbage collection is enabled using a boolean argument (`true` for enabled, `false` for disabled). Return previous GC state.
Disabling garbage collection should be used only with caution, as it can cause memory use to grow without bound.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L136-L145)
```julia
GC.@preserve x1 x2 ... xn expr
```
Mark the objects `x1, x2, ...` as being *in use* during the evaluation of the expression `expr`. This is only required in unsafe code where `expr` *implicitly uses* memory or other resources owned by one of the `x`s.
*Implicit use* of `x` covers any indirect use of resources logically owned by `x` which the compiler cannot see. Some examples:
-   Accessing memory of an object directly via a `Ptr`
-   Passing a pointer to `x` to `ccall`
-   Using resources of `x` which would be cleaned up in the finalizer.


## [Internals](#Internals)
`@preserve` should generally not have any performance impact in typical use cases where it briefly extends object lifetime. In implementation, `@preserve` has effects such as protecting dynamically allocated objects from garbage collection.
**Examples**
When loading from a pointer with `unsafe_load`, the underlying object is implicitly used, for example `x` is implicitly used by `unsafe_load(p)` in the following:
```julia-repl
julia> let
           x = Ref{Int}(101)
           p = Base.unsafe_convert(Ptr{Int}, x)
           GC.@preserve x unsafe_load(p)
       end
101
```
When passing pointers to `ccall`, the pointed-to object is implicitly used and should be preserved. (Note however that you should normally just pass `x` directly to `ccall` which counts as an explicit use.)
```julia-repl
julia> let
           x = "Hello"
           p = pointer(x)
           Int(GC.@preserve x @ccall strlen(p::Cstring)::Csize_t)
           # Preferred alternative
           Int(@ccall strlen(x::Cstring)::Csize_t)
       end
5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L186-L233)
```julia
GC.safepoint()
```
Inserts a point in the program where garbage collection may run. This can be useful in rare cases in multi-threaded programs where some threads are allocating memory (and hence may need to run GC) but other threads are doing only simple operations (no allocation, task switches, or I/O). Calling this function periodically in non-allocating threads allows garbage collection to run.


## [Internals](#Internals)
This function is available as of Julia 1.4.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L242-L254)
```julia
GC.enable_logging(on::Bool)
```
When turned on, print statistics about each GC to stderr.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L257-L261)
```julia
GC.logging_enabled()
```
Return whether GC logging has been enabled via [`GC.enable_logging`](#Base.GC.enable_logging).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L266-L270)
```julia
lower(m, x)
```
Takes the expression `x` and returns an equivalent expression in lowered form for executing in module `m`. See also [`code_lowered`](#Base.code_lowered).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L154-L160)
```julia
@lower [m] x
```
Return lowered form of the expression `x` in module `m`. By default `m` is the module in which the macro is called. See also [`lower`](#Base.Meta.lower).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L163-L169)
```julia
parse(str, start; greedy=true, raise=true, depwarn=true, filename="none")
```


## [Internals](#Internals)
Parse the expression string and return an expression (which could later be passed to eval for execution). `start` is the code unit index into `str` of the first character to start parsing at (as with all string indexing, these are not character indices). If `greedy` is `true` (default), `parse` will try to consume as much input as it can; otherwise, it will stop as soon as it has parsed a valid expression. Incomplete but otherwise syntactically valid expressions will return `Expr(:incomplete, "(error message)")`. If `raise` is `true` (default), syntax errors other than incomplete expressions will raise an error. If `raise` is `false`, `parse` will return an expression that will raise an error upon evaluation. If `depwarn` is `false`, deprecation warnings will be suppressed. The `filename` argument is used to display diagnostics when an error is raised.
```julia-repl
julia> Meta.parse("(α, β) = 3, 5", 1) # start of string
(:((α, β) = (3, 5)), 16)

julia> Meta.parse("(α, β) = 3, 5", 1, greedy=false)
(:((α, β)), 9)

julia> Meta.parse("(α, β) = 3, 5", 16) # end of string
(nothing, 16)

julia> Meta.parse("(α, β) = 3, 5", 11) # index of 3
(:((3, 5)), 16)

julia> Meta.parse("(α, β) = 3, 5", 11, greedy=false)
(3, 13)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L202-L233)
```julia
parse(str; raise=true, depwarn=true, filename="none")
```


## [Internals](#Internals)
Parse the expression string greedily, returning a single expression. An error is thrown if there are additional characters after the first expression. If `raise` is `true` (default), syntax errors will raise an error; otherwise, `parse` will return an expression that will raise an error upon evaluation. If `depwarn` is `false`, deprecation warnings will be suppressed. The `filename` argument is used to display diagnostics when an error is raised.
```julia-repl
julia> Meta.parse("x = 3")
:(x = 3)

julia> Meta.parse("1.0.2")
ERROR: ParseError:
# Error @ none:1:1
1.0.2
└──┘ ── invalid numeric constant
[...]

julia> Meta.parse("1.0.2"; raise = false)
:($(Expr(:error, "invalid numeric constant "1.0."")))

julia> Meta.parse("x = ")
:($(Expr(:incomplete, "incomplete: premature end of input")))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L247-L273)
```julia
ParseError(msg)
```
The expression passed to the [`parse`](#Base.Meta.parse-Tuple%7BAbstractString,%20Int64%7D) function could not be interpreted as a valid Julia expression.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L180-L185)
```julia
QuoteNode
```
A quoted piece of code, that does not support interpolation. See the [manual section about QuoteNodes](../../manual/metaprogramming/#man-quote-node) for details.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3564-L3568)


## [Internals](#Internals)
```julia
macroexpand(m::Module, x; recursive=true)
```
Take the expression `x` and return an equivalent expression with all macros removed (expanded) for executing in module `m`. The `recursive` keyword controls whether deeper levels of nested macros are also expanded. This is demonstrated in the example below:
```julia-repl
julia> module M
           macro m1()
               42
           end
           macro m2()
               :(@m1())
           end
       end
M

julia> macroexpand(M, :(@m2()), recursive=true)
42

julia> macroexpand(M, :(@m2()), recursive=false)
:(#= REPL[16]:6 =# M.@m1)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L98-L122)
```julia
@macroexpand [mod,] ex
```
Return equivalent expression with all macros removed (expanded). If two arguments are provided, the first is the module to evaluate in.
There are differences between `@macroexpand` and [`macroexpand`](#Base.macroexpand).
-   While [`macroexpand`](#Base.macroexpand) takes a keyword argument `recursive`, `@macroexpand` is always recursive. For a non recursive macro version, see [`@macroexpand1`](#Base.@macroexpand1).
-   While [`macroexpand`](#Base.macroexpand) has an explicit `module` argument, `@macroexpand` always expands with respect to the module in which it is called.
This is best seen in the following example:


## [Internals](#Internals)
```julia-repl
julia> module M
           macro m()
               1
           end
           function f()
               (@macroexpand(@m),
                macroexpand(M, :(@m)),
                macroexpand(Main, :(@m))
               )
           end
       end
M

julia> macro m()
           2
       end
@m (macro with 1 method)

julia> M.f()
(1, 1, 2)
```
With `@macroexpand` the expression expands where `@macroexpand` appears in the code (module `M` in the example). With `macroexpand` the expression expands in the module given as the first argument.
The two-argument form requires at least Julia 1.11.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L131-L173)
```julia
@macroexpand1 [mod,] ex
```
Non recursive version of [`@macroexpand`](#Base.@macroexpand).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/expr.jl#L181-L185)
```julia
code_lowered(f, types; generated=true, debuginfo=:default)
```
Return an array of the lowered forms (IR) for the methods matching the given generic function and type signature.
If `generated` is `false`, the returned `CodeInfo` instances will correspond to fallback implementations. An error is thrown if no fallback implementation exists. If `generated` is `true`, these `CodeInfo` instances will correspond to the method bodies yielded by expanding the generators.
The keyword `debuginfo` controls the amount of code metadata present in the output.


## [Internals](#Internals)
Note that an error will be thrown if `types` are not leaf types when `generated` is `true` and any of the corresponding methods are an `@generated` method.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1115-L1130)
```julia
code_typed(f, types; kw...)
```
Returns an array of type-inferred lowered form (IR) for the methods matching the given generic function and type signature.
**Keyword Arguments**
-   `optimize::Bool = true`: optional, controls whether additional optimizations, such as inlining, are also applied.
-   `debuginfo::Symbol = :default`: optional, controls the amount of code metadata present in the output, possible options are `:source` or `:none`.
**Internal Keyword Arguments**
This section should be considered internal, and is only for who understands Julia compiler internals.
-   `world::UInt = Base.get_world_counter()`: optional, controls the world age to use when looking up methods, use current world age if not specified.
-   `interp::Core.Compiler.AbstractInterpreter = Core.Compiler.NativeInterpreter(world)`: optional, controls the abstract interpreter to use, use the native interpreter if not specified.
**Examples**
One can put the argument types in a tuple to get the corresponding `code_typed`.
```julia
julia> code_typed(+, (Float64, Float64))
1-element Vector{Any}:
 CodeInfo(
1 ─ %1 = Base.add_float(x, y)::Float64
└──      return %1
) => Float64
```


## [Internals](#Internals)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1550-L1585)
```julia
precompile(f, argtypes::Tuple{Vararg{Any}})
```
Compile the given function `f` for the argument tuple (of types) `argtypes`, but do not execute it.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L4010-L4014)
```julia
precompile(f, argtypes::Tuple{Vararg{Any}}, m::Method)
```
Precompile a specific method for the given argument types. This may be used to precompile a different method than the one that would ordinarily be chosen by dispatch, thus mimicking `invoke`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/loading.jl#L4032-L4038)
```julia
Base.jit_total_bytes()
```
Return the total amount (in bytes) allocated by the just-in-time compiler for e.g. native code and data.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/timing.jl#L108-L113)


## [Meta](#Meta)
```julia
Meta.quot(ex)::Expr
```
Quote expression `ex` to produce an expression with head `quote`. This can for instance be used to represent objects of type `Expr` in the AST. See also the manual section about [QuoteNode](../../manual/metaprogramming/#man-quote-node).
**Examples**
```julia-repl
julia> eval(Meta.quot(:x))
:x

julia> dump(Meta.quot(:x))
Expr
  head: Symbol quote
  args: Array{Any}((1,))
    1: Symbol x

julia> eval(Meta.quot(:(1+2)))
:(1 + 2)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L22-L43)
```julia
Meta.isexpr(ex, head[, n])::Bool
```
Return `true` if `ex` is an `Expr` with the given type `head` and optionally that the argument list is of length `n`. `head` may be a `Symbol` or collection of `Symbol`s. For example, to check that a macro was passed a function call expression, you might use `isexpr(ex, :call)`.
**Examples**
```julia-repl
julia> ex = :(f(x))
:(f(x))

julia> Meta.isexpr(ex, :block)
false

julia> Meta.isexpr(ex, :call)
true

julia> Meta.isexpr(ex, [:block, :call]) # multiple possible heads
true

julia> Meta.isexpr(ex, :call, 1)
false

julia> Meta.isexpr(ex, :call, 2)
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L46-L74)
```julia
 isidentifier(s) -> Bool
```
Return whether the symbol or string `s` contains characters that are parsed as a valid ordinary identifier (not a binary/unary operator) in Julia code; see also [`Base.isoperator`](#Base.isoperator).


## [Meta](#Meta)
Internally Julia allows any sequence of characters in a `Symbol` (except `\0`s), and macros automatically use variable names containing `#` in order to avoid naming collision with the surrounding code. In order for the parser to recognize a variable, it uses a limited set of characters (greatly extended by Unicode). `isidentifier()` makes it possible to query the parser directly whether a symbol contains valid characters.
**Examples**
```julia-repl
julia> Meta.isidentifier(:x), Meta.isidentifier("1x")
(true, false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/show.jl#L1521-L1540)
```julia
isoperator(s::Symbol)
```
Return `true` if the symbol can be used as an operator, `false` otherwise.
**Examples**
```julia-repl
julia> Meta.isoperator(:+), Meta.isoperator(:f)
(true, false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/show.jl#L1555-L1565)
```julia
isunaryoperator(s::Symbol)
```
Return `true` if the symbol can be used as a unary (prefix) operator, `false` otherwise.
**Examples**
```julia-repl
julia> Meta.isunaryoperator(:-), Meta.isunaryoperator(:√), Meta.isunaryoperator(:f)
(true, true, false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/show.jl#L1568-L1578)
```julia
isbinaryoperator(s::Symbol)
```
Return `true` if the symbol can be used as a binary (infix) operator, `false` otherwise.
**Examples**


## [Meta](#Meta)
```julia-repl
julia> Meta.isbinaryoperator(:-), Meta.isbinaryoperator(:√), Meta.isbinaryoperator(:f)
(true, false, false)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/show.jl#L1583-L1593)
```julia
Meta.show_sexpr([io::IO,], ex)
```
Show expression `ex` as a lisp style S-expression.
**Examples**
```julia-repl
julia> Meta.show_sexpr(:(f(x, g(y,z))))
(:call, :f, :x, (:call, :g, :y, :z))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L106-L116)
------------------------------------------------------------------------


# Collections and Data Structures · The Julia Language
Source: https://docs.julialang.org/en/v1/base/collections/


# [Collections and Data Structures](#Collections-and-Data-Structures)


## [Iteration](#lib-collections-iteration)
Sequential iteration is implemented by the [`iterate`](#Base.iterate) function. The general `for` loop:
```julia
for i in iter   # or  "for i = iter"
    # body
end
```
is translated into:
```julia
next = iterate(iter)
while next !== nothing
    (i, state) = next
    # body
    next = iterate(iter, state)
end
```
The `state` object may be anything, and should be chosen appropriately for each iterable type. See the [manual section on the iteration interface](../../manual/interfaces/#man-interface-iteration) for more details about defining a custom iterable type.
```julia
iterate(iter [, state]) -> Union{Nothing, Tuple{Any, Any}}
```
Advance the iterator to obtain the next element. If no elements remain, `nothing` should be returned. Otherwise, a 2-tuple of the next element and the new iteration state should be returned.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1234-L1240)
```julia
IteratorSize(itertype::Type) -> IteratorSize
```
Given the type of an iterator, return one of the following values:
-   `SizeUnknown()` if the length (number of elements) cannot be determined in advance.
-   `HasLength()` if there is a fixed, finite length.
-   `HasShape{N}()` if there is a known length plus a notion of multidimensional shape (as for an array). In this case `N` should give the number of dimensions, and the [`axes`](../arrays/#Base.axes-Tuple%7BAny%7D) function is valid for the iterator.
-   `IsInfinite()` if the iterator yields values forever.


## [Iteration](#lib-collections-iteration)
The default value (for iterators that do not define this function) is `HasLength()`. This means that most iterators are assumed to implement [`length`](#Base.length).
This trait is generally used to select between algorithms that pre-allocate space for their result, and algorithms that resize their result incrementally.
```julia-repl
julia> Base.IteratorSize(1:5)
Base.HasShape{1}()

julia> Base.IteratorSize((2,3))
Base.HasLength()
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/generator.jl#L68-L93)
```julia
IteratorEltype(itertype::Type) -> IteratorEltype
```
Given the type of an iterator, return one of the following values:
-   `EltypeUnknown()` if the type of elements yielded by the iterator is not known in advance.
-   `HasEltype()` if the element type is known, and [`eltype`](#Base.eltype) would return a meaningful value.
`HasEltype()` is the default, since iterators are assumed to implement [`eltype`](#Base.eltype).
This trait is generally used to select between algorithms that pre-allocate a specific type of result, and algorithms that pick a result type based on the types of yielded values.
```julia-repl
julia> Base.IteratorEltype(1:5)
Base.HasEltype()
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/generator.jl#L109-L127)
Fully implemented by:
-   [`AbstractRange`](#Base.AbstractRange)
-   [`UnitRange`](#Base.UnitRange)
-   [`Tuple`](../base/#Core.Tuple)
-   [`Number`](../numbers/#Core.Number)


## [Iteration](#lib-collections-iteration)
-   [`AbstractArray`](../arrays/#Core.AbstractArray)
-   [`BitSet`](#Base.BitSet)
-   [`IdDict`](#Base.IdDict)
-   [`Dict`](#Base.Dict)
-   [`WeakKeyDict`](#Base.WeakKeyDict)
-   `EachLine`
-   [`AbstractString`](../strings/#Core.AbstractString)
-   [`Set`](#Base.Set)
-   [`Pair`](#Core.Pair)
-   [`NamedTuple`](../base/#Core.NamedTuple)


## [Constructors and Types](#Constructors-and-Types)
```julia
AbstractRange{T} <: AbstractVector{T}
```
Supertype for linear ranges with elements of type `T`. [`UnitRange`](#Base.UnitRange), [`LinRange`](#Base.LinRange) and other types are subtypes of this.
All subtypes must define [`step`](#Base.step). Thus [`LogRange`](../math/#Base.LogRange) is not a subtype of `AbstractRange`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L255-L263)
```julia
OrdinalRange{T, S} <: AbstractRange{T}
```
Supertype for ordinal ranges with elements of type `T` with spacing(s) of type `S`. The steps should be always-exact multiples of [`oneunit`](../numbers/#Base.oneunit), and `T` should be a "discrete" type, which cannot have values smaller than `oneunit`. For example, `Integer` or `Date` types would qualify, whereas `Float64` would not (since this type can represent values smaller than `oneunit(Float64)`. [`UnitRange`](#Base.UnitRange), [`StepRange`](#Base.StepRange), and other types are subtypes of this.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L273-L283)
```julia
AbstractUnitRange{T} <: OrdinalRange{T, T}
```
Supertype for ranges with a step size of [`oneunit(T)`](../numbers/#Base.oneunit) with elements of type `T`. [`UnitRange`](#Base.UnitRange) and other types are subtypes of this.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L286-L291)
```julia
StepRange{T, S} <: OrdinalRange{T, S}
```


## [Constructors and Types](#Constructors-and-Types)
Ranges with elements of type `T` with spacing of type `S`. The step between each element is constant, and the range is defined in terms of a `start` and `stop` of type `T` and a `step` of type `S`. Neither `T` nor `S` should be floating point types. The syntax `a:b:c` with `b != 0` and `a`, `b`, and `c` all integers creates a `StepRange`.
**Examples**
```julia-repl
julia> collect(StepRange(1, Int8(2), 10))
5-element Vector{Int64}:
 1
 3
 5
 7
 9

julia> typeof(StepRange(1, Int8(2), 10))
StepRange{Int64, Int8}

julia> typeof(1:3:6)
StepRange{Int64, Int64}
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L294-L319)
```julia
UnitRange{T<:Real}
```
A range parameterized by a `start` and `stop` of type `T`, filled with elements spaced by `1` from `start` until `stop` is exceeded. The syntax `a:b` with `a` and `b` both `Integer`s creates a `UnitRange`.
**Examples**
```julia-repl
julia> collect(UnitRange(2.3, 5.2))
3-element Vector{Float64}:
 2.3
 3.3
 4.3

julia> typeof(1:10)
UnitRange{Int64}
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L386-L404)
```julia
LinRange{T,L}
```
A range with `len` linearly spaced elements between its `start` and `stop`. The size of the spacing is controlled by `len`, which must be an `Integer`.
**Examples**
```julia-repl
julia> LinRange(1.5, 5.5, 9)
9-element LinRange{Float64, Int64}:
 1.5, 2.0, 2.5, 3.0, 3.5, 4.0, 4.5, 5.0, 5.5
```


## [Constructors and Types](#Constructors-and-Types)
Compared to using [`range`](../math/#Base.range), directly constructing a `LinRange` should have less overhead but won't try to correct for floating point errors:
```julia-repl
julia> collect(range(-0.1, 0.3, length=5))
5-element Vector{Float64}:
 -0.1
  0.0
  0.1
  0.2
  0.3

julia> collect(LinRange(-0.1, 0.3, 5))
5-element Vector{Float64}:
 -0.1
 -1.3877787807814457e-17
  0.09999999999999999
  0.19999999999999998
  0.3
```
See also [`Logrange`](../math/#Base.LogRange) for logarithmically spaced points.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/range.jl#L524-L559)


## [General Collections](#General-Collections)
```julia
isempty(collection) -> Bool
```
Determine whether a collection is empty (has no elements).
`isempty(itr)` may consume the next element of a stateful iterator `itr` unless an appropriate [`Base.isdone(itr)`](#Base.isdone) method is defined. Stateful iterators *should* implement `isdone`, but you may want to avoid using `isempty` when writing generic code which should support any iterator type.
**Examples**
```julia-repl
julia> isempty([])
true

julia> isempty([1 2 3])
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1096-L1117)
```julia
isempty(condition)
```
Return `true` if no tasks are waiting on the condition, `false` otherwise.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/condition.jl#L163-L167)
```julia
isdone(itr, [state]) -> Union{Bool, Missing}
```
This function provides a fast-path hint for iterator completion. This is useful for stateful iterators that want to avoid having elements consumed if they are not going to be exposed to the user (e.g. when checking for done-ness in `isempty` or `zip`).
Stateful iterators that want to opt into this feature should define an `isdone` method that returns true/false depending on whether the iterator is done or not. Stateless iterators need not implement this function.
If the result is `missing`, callers may go ahead and compute `iterate(x, state) === nothing` to compute a definite answer.
See also [`iterate`](#Base.iterate), [`isempty`](#Base.isempty)


## [General Collections](#General-Collections)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L1215-L1231)
```julia
empty!(collection) -> collection
```
Remove all elements from a `collection`.
**Examples**
```julia-repl
julia> A = Dict("a" => 1, "b" => 2)
Dict{String, Int64} with 2 entries:
  "b" => 2
  "a" => 1

julia> empty!(A);

julia> A
Dict{String, Int64}()
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/dict.jl#L202-L219)
```julia
empty!(c::Channel)
```
Empty a Channel `c` by calling `empty!` on the internal buffer. Return the empty channel.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/channels.jl#L221-L226)
```julia
length(collection) -> Integer
```
Return the number of elements in the collection.
Use [`lastindex`](#Base.lastindex) to get the last valid index of an indexable collection.
See also: [`size`](../arrays/#Base.size), [`ndims`](../arrays/#Base.ndims), [`eachindex`](../arrays/#Base.eachindex).
**Examples**
```julia-repl
julia> length(1:5)
5

julia> length([1, 2, 3, 4])
4

julia> length([1 2; 3 4])
4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/abstractarray.jl#L278-L298)
```julia
Base.checked_length(r)
```
Calculates `length(r)`, but may check for overflow errors where applicable when the result doesn't fit into `Union{Integer(eltype(r)),Int}`.


## [General Collections](#General-Collections)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/checked.jl#L374-L379)
Fully implemented by:
-   [`AbstractRange`](#Base.AbstractRange)
-   [`UnitRange`](#Base.UnitRange)
-   [`Tuple`](../base/#Core.Tuple)
-   [`Number`](../numbers/#Core.Number)
-   [`AbstractArray`](../arrays/#Core.AbstractArray)
-   [`BitSet`](#Base.BitSet)
-   [`IdDict`](#Base.IdDict)
-   [`Dict`](#Base.Dict)
-   [`WeakKeyDict`](#Base.WeakKeyDict)
-   [`AbstractString`](../strings/#Core.AbstractString)
-   [`Set`](#Base.Set)
-   [`NamedTuple`](../base/#Core.NamedTuple)


## [Iterable Collections](#Iterable-Collections)
```julia
in(item, collection) -> Bool
∈(item, collection) -> Bool
```
Determine whether an item is in the given collection, in the sense that it is [`==`](../math/#Base.:==) to one of the values generated by iterating over the collection. Return a `Bool` value, except if `item` is [`missing`](../../manual/missing/#missing) or `collection` contains `missing` but not `item`, in which case `missing` is returned ([three-valued logic](https://en.wikipedia.org/wiki/Three-valued_logic), matching the behavior of [`any`](#Base.any-Tuple%7BAny%7D) and [`==`](../math/#Base.:==)).
Some collections follow a slightly different definition. For example, [`Set`](#Base.Set)s check whether the item [`isequal`](../base/#Base.isequal) to one of the elements; [`Dict`](#Base.Dict)s look for `key=>value` pairs, and the `key` is compared using [`isequal`](../base/#Base.isequal).
To test for the presence of a key in a dictionary, use [`haskey`](#Base.haskey) or `k in keys(dict)`. For the collections mentioned above, the result is always a `Bool`.


## [Iterable Collections](#Iterable-Collections)
When broadcasting with `in.(items, collection)` or `items .∈ collection`, both `item` and `collection` are broadcasted over, which is often not what is intended. For example, if both arguments are vectors (and the dimensions match), the result is a vector indicating whether each value in collection `items` is `in` the value at the corresponding position in `collection`. To get a vector indicating whether each value in `items` is in `collection`, wrap `collection` in a tuple or a `Ref` like this: `in.(items, Ref(collection))` or `items .∈ Ref(collection)`.
See also: [`∉`](#Base.:∉), [`insorted`](../sort/#Base.Sort.insorted), [`contains`](../strings/#Base.contains), [`occursin`](../strings/#Base.occursin), [`issubset`](#Base.issubset).
**Examples**
```julia-repl
julia> a = 1:3:20
1:3:19

julia> 4 in a
true

julia> 5 in a
false

julia> missing in [1, 2]
missing

julia> 1 in [2, missing]
missing

julia> 1 in [1, missing]
true

julia> missing in Set([1, 2])
false

julia> (1=>missing) in Dict(1=>10, 2=>20)
missing

julia> [1, 2] .∈ [2, 3]
2-element BitVector:
 0
 0

julia> [1, 2] .∈ ([2, 3],)
2-element BitVector:
 0
 1
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1343-L1409)
```julia
∉(item, collection) -> Bool
∌(collection, item) -> Bool
```
Negation of `∈` and `∋`, i.e. checks that `item` is not in `collection`.


## [Iterable Collections](#Iterable-Collections)
When broadcasting with `items .∉ collection`, both `item` and `collection` are broadcasted over, which is often not what is intended. For example, if both arguments are vectors (and the dimensions match), the result is a vector indicating whether each value in collection `items` is not in the value at the corresponding position in `collection`. To get a vector indicating whether each value in `items` is not in `collection`, wrap `collection` in a tuple or a `Ref` like this: `items .∉ Ref(collection)`.
**Examples**
```julia-repl
julia> 1 ∉ 2:4
true

julia> 1 ∉ 1:3
false

julia> [1, 2] .∉ [2, 3]
2-element BitVector:
 1
 1

julia> [1, 2] .∉ ([2, 3],)
2-element BitVector:
 1
 0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1412-L1444)
```julia
Base.hasfastin(T)
```
Determine whether the computation `x ∈ collection` where `collection::T` can be considered as a "fast" operation (typically constant or logarithmic complexity). The definition `hasfastin(x) = hasfastin(typeof(x))` is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.
The default for `hasfastin(T)` is `true` for subtypes of [`AbstractSet`](#Base.AbstractSet), [`AbstractDict`](#Base.AbstractDict) and [`AbstractRange`](#Base.AbstractRange) and `false` otherwise.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/abstractset.jl#L348-L360)


## [Iterable Collections](#Iterable-Collections)
```julia
eltype(type)
```
Determine the type of the elements generated by iterating a collection of the given `type`. For dictionary types, this will be a `Pair{KeyType,ValType}`. The definition `eltype(x) = eltype(typeof(x))` is provided for convenience so that instances can be passed instead of types. However the form that accepts a type argument should be defined for new types.
See also: [`keytype`](#Base.keytype), [`typeof`](../base/#Core.typeof).
**Examples**
```julia-repl
julia> eltype(fill(1f0, (2,2)))
Float32

julia> eltype(fill(0x1, (2,2)))
UInt8
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/abstractarray.jl#L219-L238)
```julia
indexin(a, b)
```
Return an array containing the first index in `b` for each value in `a` that is a member of `b`. The output array contains `nothing` wherever `a` is not a member of `b`.
See also: [`sortperm`](../sort/#Base.sortperm), [`findfirst`](../arrays/#Base.findfirst-Tuple%7BAny%7D).
**Examples**
```julia-repl
julia> a = ['a', 'b', 'c', 'b', 'd', 'a'];

julia> b = ['a', 'b', 'c'];

julia> indexin(a, b)
6-element Vector{Union{Nothing, Int64}}:
 1
 2
 3
 2
  nothing
 1

julia> indexin(b, a)
3-element Vector{Union{Nothing, Int64}}:
 1
 2
 3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L2714-L2744)
```julia
unique(itr)
```


## [Iterable Collections](#Iterable-Collections)
Return an array containing only the unique elements of collection `itr`, as determined by [`isequal`](../base/#Base.isequal) and [`hash`](../base/#Base.hash), in the order that the first of each set of equivalent elements originally appears. The element type of the input is preserved.
See also: [`unique!`](#Base.unique!), [`allunique`](#Base.allunique), [`allequal`](#Base.allequal).
**Examples**
```julia-repl
julia> unique([1, 2, 6, 2])
3-element Vector{Int64}:
 1
 2
 6

julia> unique(Real[1, 1.0, 2])
2-element Vector{Real}:
 1
 2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L200-L223)
```julia
unique(f, itr)
```
Return an array containing one value from `itr` for each unique value produced by `f` applied to elements of `itr`.
**Examples**
```julia-repl
julia> unique(x -> x^2, [1, -1, 3, -3, 4])
3-element Vector{Int64}:
 1
 3
 4
```
This functionality can also be used to extract the *indices* of the first occurrences of unique elements in an array:
```julia-repl
julia> a = [3.1, 4.2, 5.3, 3.1, 3.1, 3.1, 4.2, 1.7];

julia> i = unique(i -> a[i], eachindex(a))
4-element Vector{Int64}:
 1
 2
 3
 8

julia> a[i]
4-element Vector{Float64}:
 3.1
 4.2
 5.3
 1.7

julia> a[i] == unique(a)
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L264-L300)
```julia
unique(A::AbstractArray; dims::Int)
```
Return unique regions of `A` along dimension `dims`.
**Examples**


## [Iterable Collections](#Iterable-Collections)
```julia-repl
julia> A = map(isodd, reshape(Vector(1:8), (2,2,2)))
2×2×2 Array{Bool, 3}:
[:, :, 1] =
 1  1
 0  0

[:, :, 2] =
 1  1
 0  0

julia> unique(A)
2-element Vector{Bool}:
 1
 0

julia> unique(A, dims=2)
2×1×2 Array{Bool, 3}:
[:, :, 1] =
 1
 0

[:, :, 2] =
 1
 0

julia> unique(A, dims=3)
2×2×1 Array{Bool, 3}:
[:, :, 1] =
 1  1
 0  0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/multidimensional.jl#L1685-L1723)
```julia
unique!(f, A::AbstractVector)
```
Selects one value from `A` for each unique value produced by `f` applied to elements of `A`, then return the modified A.
This method is available as of Julia 1.1.
**Examples**
```julia-repl
julia> unique!(x -> x^2, [1, -1, 3, -3, 4])
3-element Vector{Int64}:
 1
 3
 4

julia> unique!(n -> n%3, [5, 1, 8, 9, 3, 4, 10, 7, 2, 6])
3-element Vector{Int64}:
 5
 1
 9

julia> unique!(iseven, [2, 3, 5, 7, 9])
2-element Vector{Int64}:
 2
 3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L344-L372)
```julia
unique!(A::AbstractVector)
```
Remove duplicate items as determined by [`isequal`](../base/#Base.isequal) and [`hash`](../base/#Base.hash), then return the modified `A`. `unique!` will return the elements of `A` in the order that they occur. If you do not care about the order of the returned data, then calling `(sort!(A); unique!(A))` will be much more efficient as long as the elements of `A` can be sorted.
**Examples**


## [Iterable Collections](#Iterable-Collections)
```julia-repl
julia> unique!([1, 1, 1])
1-element Vector{Int64}:
 1

julia> A = [7, 3, 2, 3, 7, 5];

julia> unique!(A)
4-element Vector{Int64}:
 7
 3
 2
 5

julia> B = [7, 6, 42, 6, 7, 42];

julia> sort!(B);  # unique! is able to process sorted data much more efficiently.

julia> unique!(B)
3-element Vector{Int64}:
  6
  7
 42
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L436-L469)
```julia
allunique(itr) -> Bool
allunique(f, itr) -> Bool
```
Return `true` if all values from `itr` are distinct when compared with [`isequal`](../base/#Base.isequal). Or if all of `[f(x) for x in itr]` are distinct, for the second method.
Note that `allunique(f, itr)` may call `f` fewer than `length(itr)` times. The precise number of calls is regarded as an implementation detail.
`allunique` may use a specialized implementation when the input is sorted.
See also: [`unique`](#Base.unique), [`issorted`](../sort/#Base.issorted), [`allequal`](#Base.allequal).
The method `allunique(f, itr)` requires at least Julia 1.11.
**Examples**
```julia-repl
julia> allunique([1, 2, 3])
true

julia> allunique([1, 2, 1, 2])
false

julia> allunique(Real[1, 1.0, 2])
false

julia> allunique([NaN, 2.0, NaN, 4.0])
false

julia> allunique(abs, [1, -1, 2])
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L480-L514)
```julia
allequal(itr) -> Bool
allequal(f, itr) -> Bool
```


## [Iterable Collections](#Iterable-Collections)
Return `true` if all values from `itr` are equal when compared with [`isequal`](../base/#Base.isequal). Or if all of `[f(x) for x in itr]` are equal, for the second method.
Note that `allequal(f, itr)` may call `f` fewer than `length(itr)` times. The precise number of calls is regarded as an implementation detail.
See also: [`unique`](#Base.unique), [`allunique`](#Base.allunique).
The `allequal` function requires at least Julia 1.8.
The method `allequal(f, itr)` requires at least Julia 1.11.
**Examples**
```julia-repl
julia> allequal([])
true

julia> allequal([1])
true

julia> allequal([1, 1])
true

julia> allequal([1, 2])
false

julia> allequal(Dict(:a => 1, :b => 1))
false

julia> allequal(abs2, [1, -1])
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/set.jl#L604-L642)
```julia
reduce(op, itr; [init])
```
Reduce the given collection `itr` with the given binary operator `op`. If provided, the initial value `init` must be a neutral element for `op` that will be returned for empty collections. It is unspecified whether `init` is used for non-empty collections.
For empty collections, providing `init` will be necessary, except for some special cases (e.g. when `op` is one of `+`, `*`, `max`, `min`, `&`, `|`) when Julia can determine the neutral element of `op`.


## [Iterable Collections](#Iterable-Collections)
Reductions for certain commonly-used operators may have special implementations, and should be used instead: [`maximum`](#Base.maximum)`(itr)`, [`minimum`](#Base.minimum)`(itr)`, [`sum`](#Base.sum)`(itr)`, [`prod`](#Base.prod)`(itr)`, [`any`](#Base.any-Tuple%7BAny%7D)`(itr)`, [`all`](#Base.all-Tuple%7BAny%7D)`(itr)`. There are efficient methods for concatenating certain arrays of arrays by calling `reduce(`[`vcat`](../arrays/#Base.vcat)`, arr)` or `reduce(`[`hcat`](../arrays/#Base.hcat)`, arr)`.
The associativity of the reduction is implementation dependent. This means that you can't use non-associative operations like `-` because it is undefined whether `reduce(-,[1,2,3])` should be evaluated as `(1-2)-3` or `1-(2-3)`. Use [`foldl`](#Base.foldl-Tuple%7BAny,%20Any%7D) or [`foldr`](#Base.foldr-Tuple%7BAny,%20Any%7D) instead for guaranteed left or right associativity.
Some operations accumulate error. Parallelism will be easier if the reduction can be executed in groups. Future versions of Julia might change the algorithm. Note that the elements are not reordered if you use an ordered collection.
**Examples**
```julia-repl
julia> reduce(*, [2; 3; 4])
24

julia> reduce(*, [2; 3; 4]; init=-1)
-24
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L452-L486)
```julia
reduce(f, A::AbstractArray; dims=:, [init])
```


## [Iterable Collections](#Iterable-Collections)
Reduce 2-argument function `f` along dimensions of `A`. `dims` is a vector specifying the dimensions to reduce, and the keyword argument `init` is the initial value to use in the reductions. For `+`, `*`, `max` and `min` the `init` argument is optional.
The associativity of the reduction is implementation-dependent; if you need a particular associativity, e.g. left-to-right, you should write your own loop or consider using [`foldl`](#Base.foldl-Tuple%7BAny,%20Any%7D) or [`foldr`](#Base.foldr-Tuple%7BAny,%20Any%7D). See documentation for [`reduce`](#Base.reduce-Tuple%7BAny,%20Any%7D).
**Examples**
```julia-repl
julia> a = reshape(Vector(1:16), (4,4))
4×4 Matrix{Int64}:
 1  5   9  13
 2  6  10  14
 3  7  11  15
 4  8  12  16

julia> reduce(max, a, dims=2)
4×1 Matrix{Int64}:
 13
 14
 15
 16

julia> reduce(max, a, dims=1)
1×4 Matrix{Int64}:
 4  8  12  16
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L346-L377)
```julia
foldl(op, itr; [init])
```
Like [`reduce`](#Base.reduce-Tuple%7BAny,%20Any%7D), but with guaranteed left associativity. If provided, the keyword argument `init` will be used exactly once. In general, it will be necessary to provide `init` to work with empty collections.
See also [`mapfoldl`](#Base.mapfoldl-Tuple%7BAny,%20Any,%20Any%7D), [`foldr`](#Base.foldr-Tuple%7BAny,%20Any%7D), [`accumulate`](../arrays/#Base.accumulate).
**Examples**


## [Iterable Collections](#Iterable-Collections)
```julia-repl
julia> foldl(=>, 1:4)
((1 => 2) => 3) => 4

julia> foldl(=>, 1:4; init=0)
(((0 => 1) => 2) => 3) => 4

julia> accumulate(=>, (1,2,3,4))
(1, 1 => 2, (1 => 2) => 3, ((1 => 2) => 3) => 4)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L177-L197)
```julia
foldr(op, itr; [init])
```
Like [`reduce`](#Base.reduce-Tuple%7BAny,%20Any%7D), but with guaranteed right associativity. If provided, the keyword argument `init` will be used exactly once. In general, it will be necessary to provide `init` to work with empty collections.
**Examples**
```julia-repl
julia> foldr(=>, 1:4)
1 => (2 => (3 => 4))

julia> foldr(=>, 1:4; init=0)
1 => (2 => (3 => (4 => 0)))
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L226-L241)
```julia
maximum(f, itr; [init])
```
Return the largest result of calling function `f` on each element of `itr`.
The value returned for empty `itr` can be specified by `init`. It must be a neutral element for `max` (i.e. which is less than or equal to any other element) as it is unspecified whether `init` is used for non-empty collections.
Keyword argument `init` requires Julia 1.6 or later.
**Examples**
```julia-repl
julia> maximum(length, ["Julion", "Julia", "Jule"])
6

julia> maximum(length, []; init=-1)
-1

julia> maximum(sin, Real[]; init=-1.0)  # good, since output of sin is >= -1
-1.0
```


## [Iterable Collections](#Iterable-Collections)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L677-L701)
```julia
maximum(itr; [init])
```
Return the largest element in a collection.
The value returned for empty `itr` can be specified by `init`. It must be a neutral element for `max` (i.e. which is less than or equal to any other element) as it is unspecified whether `init` is used for non-empty collections.
Keyword argument `init` requires Julia 1.6 or later.
**Examples**
```julia-repl
julia> maximum(-20.5:10)
9.5

julia> maximum([1,2,3])
3

julia> maximum(())
ERROR: ArgumentError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
[...]

julia> maximum((); init=-Inf)
-Inf
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L731-L760)
```julia
maximum(A::AbstractArray; dims)
```
Compute the maximum value of an array over the given dimensions. See also the [`max(a,b)`](../math/#Base.max) function to take the maximum of two or more arguments, which can be applied elementwise to arrays via `max.(a,b)`.
See also: [`maximum!`](#Base.maximum!), [`extrema`](#Base.extrema), [`findmax`](#Base.findmax), [`argmax`](#Base.argmax).
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> maximum(A, dims=1)
1×2 Matrix{Int64}:
 3  4

julia> maximum(A, dims=2)
2×1 Matrix{Int64}:
 2
 4
```


## [Iterable Collections](#Iterable-Collections)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L599-L624)
```julia
maximum(f, A::AbstractArray; dims)
```
Compute the maximum value by calling the function `f` on each element of an array over the given dimensions.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> maximum(abs2, A, dims=1)
1×2 Matrix{Int64}:
 9  16

julia> maximum(abs2, A, dims=2)
2×1 Matrix{Int64}:
  4
 16
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L627-L649)
```julia
maximum!(r, A)
```
Compute the maximum value of `A` over the singleton dimensions of `r`, and write results to `r`.
Behavior can be unexpected when any mutated argument shares memory with any other argument.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> maximum!([1; 1], A)
2-element Vector{Int64}:
 2
 4

julia> maximum!([1 1], A)
1×2 Matrix{Int64}:
 3  4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L652-L675)
```julia
minimum(f, itr; [init])
```
Return the smallest result of calling function `f` on each element of `itr`.
The value returned for empty `itr` can be specified by `init`. It must be a neutral element for `min` (i.e. which is greater than or equal to any other element) as it is unspecified whether `init` is used for non-empty collections.
Keyword argument `init` requires Julia 1.6 or later.
**Examples**


## [Iterable Collections](#Iterable-Collections)
```julia-repl
julia> minimum(length, ["Julion", "Julia", "Jule"])
4

julia> minimum(length, []; init=typemax(Int64))
9223372036854775807

julia> minimum(sin, Real[]; init=1.0)  # good, since output of sin is <= 1
1.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L704-L728)
```julia
minimum(itr; [init])
```
Return the smallest element in a collection.
The value returned for empty `itr` can be specified by `init`. It must be a neutral element for `min` (i.e. which is greater than or equal to any other element) as it is unspecified whether `init` is used for non-empty collections.
Keyword argument `init` requires Julia 1.6 or later.
**Examples**
```julia-repl
julia> minimum(-20.5:10)
-20.5

julia> minimum([1,2,3])
1

julia> minimum([])
ERROR: ArgumentError: reducing over an empty collection is not allowed; consider supplying `init` to the reducer
Stacktrace:
[...]

julia> minimum([]; init=Inf)
Inf
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L763-L792)
```julia
minimum(A::AbstractArray; dims)
```
Compute the minimum value of an array over the given dimensions. See also the [`min(a,b)`](../math/#Base.min) function to take the minimum of two or more arguments, which can be applied elementwise to arrays via `min.(a,b)`.
See also: [`minimum!`](#Base.minimum!), [`extrema`](#Base.extrema), [`findmin`](#Base.findmin), [`argmin`](#Base.argmin).
**Examples**


## [Iterable Collections](#Iterable-Collections)
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> minimum(A, dims=1)
1×2 Matrix{Int64}:
 1  2

julia> minimum(A, dims=2)
2×1 Matrix{Int64}:
 1
 3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L678-L703)
```julia
minimum(f, A::AbstractArray; dims)
```
Compute the minimum value by calling the function `f` on each element of an array over the given dimensions.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> minimum(abs2, A, dims=1)
1×2 Matrix{Int64}:
 1  4

julia> minimum(abs2, A, dims=2)
2×1 Matrix{Int64}:
 1
 9
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L706-L728)
```julia
minimum!(r, A)
```
Compute the minimum value of `A` over the singleton dimensions of `r`, and write results to `r`.
Behavior can be unexpected when any mutated argument shares memory with any other argument.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> minimum!([1; 1], A)
2-element Vector{Int64}:
 1
 3

julia> minimum!([1 1], A)
1×2 Matrix{Int64}:
 1  2
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reducedim.jl#L731-L754)
```julia
extrema(itr; [init]) -> (mn, mx)
```
Compute both the minimum `mn` and maximum `mx` element in a single pass, and return them as a 2-tuple.


## [Iterable Collections](#Iterable-Collections)
The value returned for empty `itr` can be specified by `init`. It must be a 2-tuple whose first and second elements are neutral elements for `min` and `max` respectively (i.e. which are greater/less than or equal to any other element). As a consequence, when `itr` is empty the returned `(mn, mx)` tuple will satisfy `mn ≥ mx`. When `init` is specified it may be used even for non-empty `itr`.
Keyword argument `init` requires Julia 1.8 or later.
**Examples**
```julia-repl
julia> extrema(2:10)
(2, 10)

julia> extrema([9,pi,4.5])
(3.141592653589793, 9.0)

julia> extrema([]; init = (Inf, -Inf))
(Inf, -Inf)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reduce.jl#L795-L821)
```julia
extrema(f, itr; [init]) -> (mn, mx)
```
Compute both the minimum `mn` and maximum `mx` of `f` applied to each element in `itr` and return them as a 2-tuple. Only one pass is made over `itr`.
The value returned for empty `itr` can be specified by `init`. It must be a 2-tuple whose first and second elements are neutral elements for `min` and `max` respectively (i.e. which are greater/less than or equal to any other element). It is used for non-empty collections. Note: it implies that, for empty `itr`, the returned value `(mn, mx)` satisfies `mn ≥ mx` even though for non-empty `itr` it satisfies `mn ≤ mx`. This is a "paradoxical" but yet expected result.
This method requires Julia 1.2 or later.
Keyword argument `init` requires Julia 1.8 or later.
**Examples**