## [Getting Around](#Getting-Around)
If `types` is specified, return an array of methods whose types match. If `module` is specified, return an array of methods defined in that module. A list of modules can also be specified as an array.
At least Julia 1.4 is required for specifying a module.
See also: [`which`](#Base.which-Tuple%7BAny,%20Any%7D), [`@which`](../../stdlib/InteractiveUtils/#InteractiveUtils.@which) and [`methodswith`](../../stdlib/InteractiveUtils/#InteractiveUtils.methodswith).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1204-L1217)
```julia
@show exs...
```
Prints one or more expressions, and their results, to `stdout`, and returns the last result.
See also: [`show`](../io-network/#Base.show-Tuple%7BIO,%20Any%7D), [`@info`](../../stdlib/Logging/#man-logging), [`println`](../io-network/#Base.println).
**Examples**
```julia-repl
julia> x = @show 1+2
1 + 2 = 3
3

julia> @show x^2 x/2;
x ^ 2 = 9
x / 2 = 1.5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/show.jl#L1210-L1227)
```julia
ans
```
A variable referring to the last computed value, automatically imported to the interactive prompt.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/client.jl#L498-L502)
```julia
err
```
A variable referring to the last thrown errors, automatically imported to the interactive prompt. The thrown errors are collected in a stack of exceptions.


## [Getting Around](#Getting-Around)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/client.jl#L505-L510)
```julia
active_project()
```
Return the path of the active `Project.toml` file. See also [`Base.set_active_project`](#Base.set_active_project).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/initdefs.jl#L318-L322)
```julia
set_active_project(projfile::Union{AbstractString,Nothing})
```
Set the active `Project.toml` file to `projfile`. See also [`Base.active_project`](#Base.active_project).
This function requires at least Julia 1.8.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/initdefs.jl#L347-L354)


## [Keywords](#Keywords)
This is the list of reserved keywords in Julia: `baremodule`, `begin`, `break`, `catch`, `const`, `continue`, `do`, `else`, `elseif`, `end`, `export`, `false`, `finally`, `for`, `function`, `global`, `if`, `import`, `let`, `local`, `macro`, `module`, `quote`, `return`, `struct`, `true`, `try`, `using`, `while`. Those keywords are not allowed to be used as variable names.
The following two-word sequences are reserved: `abstract type`, `mutable struct`, `primitive type`. However, you can create variables with names: `abstract`, `mutable`, `primitive` and `type`.
Finally: `where` is parsed as an infix operator for writing parametric method and type definitions; `in` and `isa` are parsed as infix operators; `public` is parsed as a keyword when beginning a toplevel statement; `outer` is parsed as a keyword when used to modify the scope of a variable in an iteration specification of a `for` loop; and `as` is used as a keyword to rename an identifier brought into scope by `import` or `using`. Creation of variables named `where`, `in`, `isa`, `outer` and `as` is allowed, though.
```julia
module
```


## [Keywords](#Keywords)
`module` declares a [`Module`](#Core.Module), which is a separate global variable workspace. Within a module, you can control which names from other modules are visible (via importing), and specify which of your names are intended to be public (via `export` and `public`). Modules allow you to create top-level definitions without worrying about name conflicts when your code is used together with somebody else’s. See the [manual section about modules](../../manual/modules/#modules) for more details.
**Examples**
```julia
module Foo
import Base.show
export MyType, foo

struct MyType
    x
end

bar(x) = 2x
foo(a::MyType) = bar(a.x) + 1
show(io::IO, a::MyType) = print(io, "MyType $(a.x)")
end
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L122-L147)
```julia
export
```
`export` is used within modules to tell Julia which names should be made available to the user. For example: `export foo` makes the name `foo` available when [`using`](#using) the module. See the [manual section about modules](../../manual/modules/#modules) for details.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L61-L68)
```julia
public
```
`public` is used within modules to tell Julia which names are part of the public API of the module . For example: `public foo` indicates that the name `foo` is public, without making it available when [`using`](#using) the module. See the [manual section about modules](../../manual/modules/#modules) for details.


## [Keywords](#Keywords)
The public keyword was added in Julia 1.11. Prior to this the notion of publicness was less explicit.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L71-L82)
```julia
import
```
`import Foo` will load the module or package `Foo`. Names from the imported `Foo` module can be accessed with dot syntax (e.g. `Foo.foo` to access the name `foo`). See the [manual section about modules](../../manual/modules/#modules) for details.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L51-L58)
```julia
using
```
`using Foo` will load the module or package `Foo` and make its [`export`](#export)ed names available for direct use. Names can also be used via dot syntax (e.g. `Foo.foo` to access the name `foo`), whether they are `export`ed or not. See the [manual section about modules](../../manual/modules/#modules) for details.
When two or more packages/modules export a name and that name does not refer to the same thing in each of the packages, and the packages are loaded via `using` without an explicit list of names, it is an error to reference that name without qualification. It is thus recommended that code intended to be forward-compatible with future versions of its dependencies and of Julia, e.g., code in released packages, list the names it uses from each loaded package, e.g., `using Foo: Foo, f` rather than `using Foo`.


## [Keywords](#Keywords)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L33-L48)
```julia
as
```
`as` is used as a keyword to rename an identifier brought into scope by `import` or `using`, for the purpose of working around name conflicts as well as for shortening names. (Outside of `import` or `using` statements, `as` is not a keyword and can be used as an ordinary identifier.)
`import LinearAlgebra as LA` brings the imported `LinearAlgebra` standard library into scope as `LA`.
`import LinearAlgebra: eigen as eig, cholesky as chol` brings the `eigen` and `cholesky` methods from `LinearAlgebra` into scope as `eig` and `chol` respectively.
`as` works with `using` only when individual identifiers are brought into scope. For example, `using LinearAlgebra: eigen as eig` or `using LinearAlgebra: eigen as eig, cholesky as chol` works, but `using LinearAlgebra as LA` is invalid syntax, since it is nonsensical to rename *all* exported names from `LinearAlgebra` to `LA`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L85-L103)
```julia
baremodule
```
`baremodule` declares a module that does not contain `using Base` or local definitions of [`eval`](#eval) and [`include`](#Base.include). It does still import `Core`. In other words,
```julia
module Mod

...

end
```
is equivalent to
```julia
baremodule Mod

using Base

eval(x) = Core.eval(Mod, x)
include(p) = Base.include(Mod, p)

...

end
```


## [Keywords](#Keywords)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L173-L201)
```julia
function
```
Functions are defined with the `function` keyword:
```julia
function add(a, b)
    return a + b
end
```
Or the short form notation:
```julia
add(a, b) = a + b
```
The use of the [`return`](#return) keyword is exactly the same as in other languages, but is often optional. A function without an explicit `return` statement will return the last expression in the function body.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L807-L826)
```julia
macro
```
`macro` defines a method for inserting generated code into a program. A macro maps a sequence of argument expressions to a returned expression, and the resulting expression is substituted directly into the program at the point where the macro is invoked. Macros are a way to run generated code without calling [`eval`](#eval), since the generated code instead simply becomes part of the surrounding program. Macro arguments may include expressions, literal values, and symbols. Macros can be defined for variable number of arguments (varargs), but do not accept keyword arguments. Every macro also implicitly gets passed the arguments `__source__`, which contains the line number and file name the macro is called from, and `__module__`, which is the module the macro is expanded in.


## [Keywords](#Keywords)
See the manual section on [Metaprogramming](../../manual/metaprogramming/#Metaprogramming) for more information about how to write a macro.
**Examples**
```julia-repl
julia> macro sayhello(name)
           return :( println("Hello, ", $name, "!") )
       end
@sayhello (macro with 1 method)

julia> @sayhello "Charlie"
Hello, Charlie!

julia> macro saylots(x...)
           return :( println("Say: ", $(x...)) )
       end
@saylots (macro with 1 method)

julia> @saylots "hey " "there " "friend"
Say: hey there friend
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L222-L257)
```julia
return
```
`return x` causes the enclosing function to exit early, passing the given value `x` back to its caller. `return` by itself with no value is equivalent to `return nothing` (see [`nothing`](../constants/#Core.nothing)).
```julia
function compare(a, b)
    a == b && return "equal to"
    a < b ? "less than" : "greater than"
end
```
In general you can place a `return` statement anywhere within a function body, including within deeply nested loops or conditionals, but be careful with `do` blocks. For example:
```julia
function test1(xs)
    for x in xs
        iseven(x) && return 2x
    end
end

function test2(xs)
    map(xs) do x
        iseven(x) && return 2x
        x
    end
end
```
In the first example, the return breaks out of `test1` as soon as it hits an even number, so `test1([5,6,7])` returns `12`.


## [Keywords](#Keywords)
You might expect the second example to behave the same way, but in fact the `return` there only breaks out of the *inner* function (inside the `do` block) and gives a value back to `map`. `test2([5,6,7])` then returns `[5,12,7]`.
When used in a top-level expression (i.e. outside any function), `return` causes the entire current top-level expression to terminate early.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L855-L895)
```julia
do
```
Create an anonymous function and pass it as the first argument to a function call. For example:
```julia
map(1:10) do x
    2x
end
```
is equivalent to `map(x->2x, 1:10)`.
Use multiple arguments like so:
```julia
map(1:10, 11:20) do x, y
    x + y
end
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1129-L1151)
```julia
begin
```
`begin...end` denotes a block of code.
```julia
begin
    println("Hello, ")
    println("World!")
end
```
Usually `begin` will not be necessary, since keywords such as [`function`](#function) and [`let`](#let) implicitly begin blocks of code. See also [`;`](#;).
`begin` may also be used when indexing to represent the first index of a collection or the first index of a dimension of an array. For example, `a[begin]` is the first element of an array `a`.
Use of `begin` as an index requires Julia 1.4 or later.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Array{Int64,2}:
 1  2
 3  4

julia> A[begin, :]
2-element Array{Int64,1}:
 1
 2
```


## [Keywords](#Keywords)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1352-L1386)
```julia
end
```
`end` marks the conclusion of a block of expressions, for example [`module`](#module), [`struct`](#struct), [`mutable struct`](#mutable%20struct), [`begin`](#begin), [`let`](#let), [`for`](#for) etc.
`end` may also be used when indexing to represent the last index of a collection or the last index of a dimension of an array.
**Examples**
```julia-repl
julia> A = [1 2; 3 4]
2×2 Array{Int64, 2}:
 1  2
 3  4

julia> A[end, :]
2-element Array{Int64, 1}:
 3
 4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1000-L1022)
```julia
let
```
`let` blocks create a new hard scope and optionally introduce new local bindings.
Just like the [other scope constructs](../../manual/variables-and-scoping/#man-scope-table), `let` blocks define the block of code where newly introduced local variables are accessible. Additionally, the syntax has a special meaning for comma-separated assignments and variable names that may optionally appear on the same line as the `let`:
```julia
let var1 = value1, var2, var3 = value3
    code
end
```


## [Keywords](#Keywords)
The variables introduced on this line are local to the `let` block and the assignments are evaluated in order, with each right-hand side evaluated in the scope without considering the name on the left-hand side. Therefore it makes sense to write something like `let x = x`, since the two `x` variables are distinct with the left-hand side locally shadowing the `x` from the outer scope. This can even be a useful idiom as new local variables are freshly created each time local scopes are entered, but this is only observable in the case of variables that outlive their scope via closures. A `let` variable without an assignment, such as `var2` in the example above, declares a new local variable that is not yet bound to a value.
By contrast, [`begin`](#begin) blocks also group multiple expressions together but do not introduce scope or have the special assignment syntax.
**Examples**
In the function below, there is a single `x` that is iteratively updated three times by the `map`. The closures returned all reference that one `x` at its final value:
```julia-repl
julia> function test_outer_x()
           x = 0
           map(1:3) do _
               x += 1
               return ()->x
           end
       end
test_outer_x (generic function with 1 method)

julia> [f() for f in test_outer_x()]
3-element Vector{Int64}:
 3
 3
 3
```
If, however, we add a `let` block that introduces a *new* local variable we will end up with three distinct variables being captured (one at each iteration) even though we chose to use (shadow) the same name.


## [Keywords](#Keywords)
```julia-repl
julia> function test_let_x()
           x = 0
           map(1:3) do _
               x += 1
               let x = x
                   return ()->x
               end
           end
       end
test_let_x (generic function with 1 method)

julia> [f() for f in test_let_x()]
3-element Vector{Int64}:
 1
 2
 3
```
All scope constructs that introduce new local variables behave this way when repeatedly run; the distinctive feature of `let` is its ability to succinctly declare new `local`s that may shadow outer variables of the same name. For example, directly using the argument of the `do` function similarly captures three distinct variables:
```julia-repl
julia> function test_do_x()
           map(1:3) do x
               return ()->x
           end
       end
test_do_x (generic function with 1 method)

julia> [f() for f in test_do_x()]
3-element Vector{Int64}:
 1
 2
 3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L523-L619)
```julia
if/elseif/else
```
`if`/`elseif`/`else` performs conditional evaluation, which allows portions of code to be evaluated or not evaluated depending on the value of a boolean expression. Here is the anatomy of the `if`/`elseif`/`else` conditional syntax:
```julia
if x < y
    println("x is less than y")
elseif x > y
    println("x is greater than y")
else
    println("x is equal to y")
end
```


## [Keywords](#Keywords)
If the condition expression `x < y` is true, then the corresponding block is evaluated; otherwise the condition expression `x > y` is evaluated, and if it is true, the corresponding block is evaluated; if neither expression is true, the `else` block is evaluated. The `elseif` and `else` blocks are optional, and as many `elseif` blocks as desired can be used.
In contrast to some other languages conditions must be of type `Bool`. It does not suffice for conditions to be convertible to `Bool`.
```julia-repl
julia> if 1 end
ERROR: TypeError: non-boolean (Int64) used in boolean context
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L898-L926)
```julia
for
```
`for` loops repeatedly evaluate a block of statements while iterating over a sequence of values.
The iteration variable is always a new variable, even if a variable of the same name exists in the enclosing scope. Use [`outer`](#outer) to reuse an existing local variable for iteration.
**Examples**
```julia-repl
julia> for i in [1, 4, 0]
           println(i)
       end
1
4
0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L954-L973)
```julia
while
```
`while` loops repeatedly evaluate a conditional expression, and continue evaluating the body of the while loop as long as the expression remains true. If the condition expression is false when the while loop is first reached, the body is never evaluated.
**Examples**


## [Keywords](#Keywords)
```julia-repl
julia> i = 1
1

julia> while i < 5
           println(i)
           global i += 1
       end
1
2
3
4
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L976-L997)
```julia
break
```
Break out of a loop immediately.
**Examples**
```julia-repl
julia> i = 0
0

julia> while true
           global i += 1
           i > 5 && break
           println(i)
       end
1
2
3
4
5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1087-L1108)
```julia
continue
```
Skip the rest of the current loop iteration.
**Examples**
```julia-repl
julia> for i = 1:6
           iseven(i) && continue
           println(i)
       end
1
3
5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1111-L1126)
```julia
try/catch
```
A `try`/`catch` statement allows intercepting errors (exceptions) thrown by [`throw`](#Core.throw) so that program execution can continue. For example, the following code attempts to write a file, but warns the user and proceeds instead of terminating execution if the file cannot be written:
```julia
try
    open("/danger", "w") do f
        println(f, "Hello")
    end
catch
    @warn "Could not write file."
end
```
or, when the file cannot be read into a variable:
```julia
lines = try
    open("/danger", "r") do f
        readlines(f)
    end
catch
    @warn "File not found."
end
```


## [Keywords](#Keywords)
The syntax `catch e` (where `e` is any variable) assigns the thrown exception object to the given variable within the `catch` block.
The power of the `try`/`catch` construct lies in the ability to unwind a deeply nested computation immediately to a much higher level in the stack of calling functions.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1025-L1060)
```julia
finally
```
Run some code when a given block of code exits, regardless of how it exits. For example, here is how we can guarantee that an opened file is closed:
```julia
f = open("file")
try
    operate_on_file(f)
finally
    close(f)
end
```
When control leaves the [`try`](#try) block (for example, due to a [`return`](#return), or just finishing normally), [`close(f)`](../io-network/#Base.close) will be executed. If the `try` block exits due to an exception, the exception will continue propagating. A `catch` block may be combined with `try` and `finally` as well. In this case the `finally` block will run after `catch` has handled the error.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1063-L1084)
```julia
quote
```
`quote` creates multiple expression objects in a block without using the explicit [`Expr`](#Core.Expr) constructor. For example:
```julia
ex = quote
    x = 1
    y = 2
    x + y
end
```


## [Keywords](#Keywords)
Unlike the other means of quoting, `:( ... )`, this form introduces `QuoteNode` elements to the expression tree, which must be considered when directly manipulating the tree. For other purposes, `:( ... )` and `quote .. end` blocks are treated identically.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L622-L638)
```julia
local
```
`local` introduces a new local variable. See the [manual section on variable scoping](../../manual/variables-and-scoping/#scope-of-variables) for more information.
**Examples**
```julia-repl
julia> function foo(n)
           x = 0
           for i = 1:n
               local x # introduce a loop-local x
               x = i
           end
           x
       end
foo (generic function with 1 method)

julia> foo(10)
0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L278-L299)
```julia
global
```
`global x` makes `x` in the current scope and its inner scopes refer to the global variable of that name. See the [manual section on variable scoping](../../manual/variables-and-scoping/#scope-of-variables) for more information.
**Examples**
```julia-repl
julia> z = 3
3

julia> function foo()
           global z = 6 # use the z variable defined outside foo
       end
foo (generic function with 1 method)

julia> foo()
6

julia> z
6
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L302-L325)
```julia
for outer
```


## [Keywords](#Keywords)
Reuse an existing local variable for iteration in a `for` loop.
See the [manual section on variable scoping](../../manual/variables-and-scoping/#scope-of-variables) for more information.
See also [`for`](#for).
**Examples**
```julia-repl
julia> function f()
           i = 0
           for i = 1:3
               # empty
           end
           return i
       end;

julia> f()
0
```
```julia-repl
julia> function f()
           i = 0
           for outer i = 1:3
               # empty
           end
           return i
       end;

julia> f()
3
```
```julia-repl
julia> i = 0 # global variable
       for outer i = 1:3
       end
ERROR: syntax: no outer local variable declaration exists for "for outer"
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L328-L372)
```julia
const
```
`const` is used to declare global variables whose values will not change. In almost all code (and particularly performance sensitive code) global variables should be declared constant in this way.
```julia
const x = 5
```
Multiple variables can be declared within a single `const`:
```julia
const y, z = 7, 11
```
Note that `const` only applies to one `=` operation, therefore `const x = y = 1` declares `x` to be constant but not `y`. On the other hand, `const x = const y = 1` declares both `x` and `y` constant.


## [Keywords](#Keywords)
Note that "constant-ness" does not extend into mutable containers; only the association between a variable and its value is constant. If `x` is an array or dictionary (for example) you can still modify, add, or remove elements.
In some cases changing the value of a `const` variable gives a warning instead of an error. However, this can produce unpredictable behavior or corrupt the state of your program, and so should be avoided. This feature is intended only for convenience during interactive use.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L775-L804)
```julia
struct
```
The most commonly used kind of type in Julia is a struct, specified as a name and a set of fields.
```julia
struct Point
    x
    y
end
```
Fields can have type restrictions, which may be parameterized:
```julia
struct Point{X}
    x::X
    y::Float64
end
```
A struct can also declare an abstract super type via `<:` syntax:
```julia
struct Point <: AbstractPoint
    x
    y
end
```
`struct`s are immutable by default; an instance of one of these types cannot be modified after construction. Use [`mutable struct`](#mutable%20struct) instead to declare a type whose instances can be modified.
See the manual section on [Composite Types](../../manual/types/#Composite-Types) for more details, such as how to define constructors.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1389-L1426)
```julia
mutable struct
```


## [Keywords](#Keywords)
`mutable struct` is similar to [`struct`](#struct), but additionally allows the fields of the type to be set after construction.
Individual fields of a mutable struct can be marked as `const` to make them immutable:
```julia
mutable struct Baz
    a::Int
    const b::Float64
end
```
The `const` keyword for fields of mutable structs requires at least Julia 1.8.
See the manual section on [Composite Types](../../manual/types/#Composite-Types) for more information.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1429-L1447)
```julia
@kwdef typedef
```
This is a helper macro that automatically defines a keyword-based constructor for the type declared in the expression `typedef`, which must be a `struct` or `mutable struct` expression. The default argument is supplied by declaring fields of the form `field::T = default` or `field = default`. If no default is provided then the keyword argument becomes a required keyword argument in the resulting type constructor.
Inner constructors can still be defined, but at least one should accept arguments in the same form as the default inner constructor (i.e. one positional argument per field) in order to function correctly with the keyword outer constructor.
`Base.@kwdef` for parametric structs, and structs with supertypes requires at least Julia 1.1.
This macro is exported as of Julia 1.9.
**Examples**


## [Keywords](#Keywords)
```julia-repl
julia> @kwdef struct Foo
           a::Int = 1         # specified default
           b::String          # required keyword
       end
Foo

julia> Foo(b="hi")
Foo(1, "hi")

julia> Foo()
ERROR: UndefKeywordError: keyword argument `b` not assigned
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/util.jl#L526-L562)
```julia
abstract type
```
`abstract type` declares a type that cannot be instantiated, and serves only as a node in the type graph, thereby describing sets of related concrete types: those concrete types which are their descendants. Abstract types form the conceptual hierarchy which makes Julia’s type system more than just a collection of object implementations. For example:
```julia
abstract type Number end
abstract type Real <: Number end
```
[`Number`](../numbers/#Core.Number) has no supertype, whereas [`Real`](../numbers/#Core.Real) is an abstract subtype of `Number`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L106-L119)
```julia
primitive type
```
`primitive type` declares a concrete type whose data consists only of a series of bits. Classic examples of primitive types are integers and floating-point values. Some example built-in primitive type declarations:
```julia
primitive type Char 32 end
primitive type Bool <: Integer 8 end
```


## [Keywords](#Keywords)
The number after the name indicates how many bits of storage the type requires. Currently, only sizes that are multiples of 8 bits are supported. The [`Bool`](../numbers/#Core.Bool) declaration shows how a primitive type can be optionally declared to be a subtype of some supertype.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L204-L219)
```julia
where
```
The `where` keyword creates a [`UnionAll`](#Core.UnionAll) type, which may be thought of as an iterated union of other types, over all values of some variable. For example `Vector{T} where T<:Real` includes all [`Vector`](../arrays/#Base.Vector)s where the element type is some kind of `Real` number.
The variable bound defaults to [`Any`](#Core.Any) if it is omitted:
```julia
Vector{T} where T    # short for `where T<:Any`
```
Variables can also have lower bounds:
```julia
Vector{T} where T>:Int
Vector{T} where Int<:T<:Real
```
There is also a concise syntax for nested `where` expressions. For example, this:
```julia
Pair{T, S} where S<:Array{T} where T<:Number
```
can be shortened to:
```julia
Pair{T, S} where {T<:Number, S<:Array{T}}
```
This form is often found on method signatures.
Note that in this form, the variables are listed outermost-first. This matches the order in which variables are substituted when a type is "applied" to parameter values using the syntax `T{p1, p2, ...}`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1460-L1493)
```julia
...
```


## [Keywords](#Keywords)
The "splat" operator, `...`, represents a sequence of arguments. `...` can be used in function definitions, to indicate that the function accepts an arbitrary number of arguments. `...` can also be used to apply a function to a sequence of arguments.
**Examples**
```julia-repl
julia> add(xs...) = reduce(+, xs)
add (generic function with 1 method)

julia> add(1, 2, 3, 4, 5)
15

julia> add([1, 2, 3]...)
6

julia> add(7, 1:100..., 1000:1100...)
111107
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1154-L1176)
```julia
;
```
`;` has a similar role in Julia as in many C-like languages, and is used to delimit the end of the previous statement.
`;` is not necessary at the end of a line, but can be used to separate statements on a single line or to join statements into a single expression.
Adding `;` at the end of a line in the REPL will suppress printing the result of that expression.
In function declarations, and optionally in calls, `;` separates regular arguments from keywords.
In array literals, arguments separated by semicolons have their contents concatenated together. A separator made of a single `;` concatenates vertically (i.e. along the first dimension), `;;` concatenates horizontally (second dimension), `;;;` concatenates along the third dimension, etc. Such a separator can also be used in last position in the square brackets to add trailing dimensions of length 1.


## [Keywords](#Keywords)
A `;` in first position inside of parentheses can be used to construct a named tuple. The same `(; ...)` syntax on the left side of an assignment allows for property destructuring.
In the standard REPL, typing `;` on an empty line will switch to shell mode.
**Examples**
```julia-repl
julia> function foo()
           x = "Hello, "; x *= "World!"
           return x
       end
foo (generic function with 1 method)

julia> bar() = (x = "Hello, Mars!"; return x)
bar (generic function with 1 method)

julia> foo();

julia> bar()
"Hello, Mars!"

julia> function plot(x, y; style="solid", width=1, color="black")
           ###
       end

julia> A = [1 2; 3 4]
2×2 Matrix{Int64}:
 1  2
 3  4

julia> [1; 3;; 2; 4;;; 10*A]
2×2×2 Array{Int64, 3}:
[:, :, 1] =
 1  2
 3  4

[:, :, 2] =
 10  20
 30  40

julia> [2; 3;;;]
2×1×1 Array{Int64, 3}:
[:, :, 1] =
 2
 3

julia> nt = (; x=1) # without the ; or a trailing comma this would assign to x
(x = 1,)

julia> key = :a; c = 3;

julia> nt2 = (; key => 1, b=2, c, nt.x)
(a = 1, b = 2, c = 3, x = 1)

julia> (; b, x) = nt2; # set variables b and x using property destructuring

julia> b, x
(2, 1)

julia> ; # upon typing ;, the prompt changes (in place) to: shell>
shell> echo hello
hello
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1179-L1263)
```julia
=
```
`=` is the assignment operator.
-   For variable `a` and expression `b`, `a = b` makes `a` refer to the value of `b`.


## [Keywords](#Keywords)
-   For functions `f(x)`, `f(x) = x` defines a new function constant `f`, or adds a new method to `f` if `f` is already defined; this usage is equivalent to `function f(x); x; end`.
-   `a[i] = v` calls [`setindex!`](../collections/#Base.setindex!)`(a,v,i)`.
-   `a.b = c` calls [`setproperty!`](#Base.setproperty!)`(a,:b,c)`.
-   Inside a function call, `f(a=b)` passes `b` as the value of keyword argument `a`.
-   Inside parentheses with commas, `(a=1,)` constructs a [`NamedTuple`](#Core.NamedTuple).
**Examples**
Assigning `a` to `b` does not create a copy of `b`; instead use [`copy`](#Base.copy) or [`deepcopy`](#Base.deepcopy).
```julia-repl
julia> b = [1]; a = b; b[1] = 2; a
1-element Array{Int64, 1}:
 2

julia> b = [1]; a = copy(b); b[1] = 2; a
1-element Array{Int64, 1}:
 1
```
Collections passed to functions are also not copied. Functions can modify (mutate) the contents of the objects their arguments refer to. (The names of functions which do this are conventionally suffixed with '!'.)
```julia-repl
julia> function f!(x); x[:] .+= 1; end
f! (generic function with 1 method)

julia> a = [1]; f!(a); a
1-element Array{Int64, 1}:
 2
```
Assignment can operate on multiple variables in parallel, taking values from an iterable:
```julia-repl
julia> a, b = 4, 5
(4, 5)

julia> a, b = 1:3
1:3

julia> a, b
(1, 2)
```
Assignment can operate on multiple variables in series, and will return the value of the right-hand-most expression:


## [Keywords](#Keywords)
```julia-repl
julia> a = [1]; b = [2]; c = [3]; a = b = c
1-element Array{Int64, 1}:
 3

julia> b[1] = 2; a, b, c
([2], [2], [2])
```
Assignment at out-of-bounds indices does not grow a collection. If the collection is a [`Vector`](../arrays/#Base.Vector) it can instead be grown with [`push!`](../collections/#Base.push!) or [`append!`](../collections/#Base.append!).
```julia-repl
julia> a = [1, 1]; a[3] = 2
ERROR: BoundsError: attempt to access 2-element Array{Int64, 1} at index [3]
[...]

julia> push!(a, 2, 3)
4-element Array{Int64, 1}:
 1
 1
 2
 3
```
Assigning `[]` does not eliminate elements from a collection; instead use [`filter!`](../collections/#Base.filter!).
```julia-repl
julia> a = collect(1:3); a[a .<= 1] = []
ERROR: DimensionMismatch: tried to assign 0 elements to 1 destinations
[...]

julia> filter!(x -> x > 1, a) # in-place & thus more efficient than a = a[a .> 1]
2-element Array{Int64, 1}:
 2
 3
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L388-L470)
```julia
a ? b : c
```
Short form for conditionals; read "if `a`, evaluate `b` otherwise evaluate `c`". Also known as the [ternary operator](https://en.wikipedia.org/wiki/%3F:).
This syntax is equivalent to `if a; b else c end`, but is often used to emphasize the value `b`-or-`c` which is being used as part of a larger expression, rather than the side effects that evaluating `b` or `c` may have.
See the manual section on [control flow](../../manual/control-flow/#man-conditional-evaluation) for more details.


## [Keywords](#Keywords)
**Examples**
```julia-repl
julia> x = 1; y = 2;

julia> x > y ? println("x is larger") : println("x is not larger")
x is not larger

julia> x > y ? "x is larger" : x == y ? "x and y are equal" : "y is larger"
"y is larger"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L929-L951)


## [Standard Modules](#Standard-Modules)
```julia
Main
```
`Main` is the top-level module, and Julia starts with `Main` set as the current module. Variables defined at the prompt go in `Main`, and `varinfo` lists variables in `Main`.
```julia-repl
julia> @__MODULE__
Main
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3546-L3554)
```julia
Core
```
`Core` is the module that contains all identifiers considered "built in" to the language, i.e. part of the core language and not libraries. Every module implicitly specifies `using Core`, since you can't do anything without those definitions.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3539-L3543)
```julia
Base
```
The base library of Julia. `Base` is a module that contains basic functionality (the contents of `base/`). All modules implicitly contain `using Base`, since this is needed in the vast majority of cases.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3557-L3561)


## [Base Submodules](#Base-Submodules)
```julia
Base.Broadcast
```
Module containing the broadcasting implementation.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/broadcast.jl#L3-L7)
```julia
Docs
```
The `Docs` module provides the [`@doc`](#Core.@doc) macro which can be used to set and retrieve documentation metadata for Julia objects.
Please see the manual section on [documentation](../../manual/documentation/#man-documentation) for more information.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/Docs.jl#L3-L11)
Methods for working with Iterators.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/iterators.jl#L3-L5)
Interface to libc, the C standard library.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/libc.jl#L4-L6)
Convenience functions for metaprogramming.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/meta.jl#L3-L5)
Tools for collecting and manipulating stack traces. Mainly used for building errors.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/stacktraces.jl#L3-L5)
Provide methods for retrieving information about hardware and the operating system.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/sysinfo.jl#L4-L6)
Multithreading support.


## [Base Submodules](#Base-Submodules)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/threads.jl#L3-L5)
```julia
Base.GC
```
Module with garbage collection utilities.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L105-L109)


## [All Objects](#All-Objects)
```julia
===(x,y) -> Bool
≡(x,y) -> Bool
```
Determine whether `x` and `y` are identical, in the sense that no program could distinguish them. First the types of `x` and `y` are compared. If those are identical, mutable objects are compared by address in memory and immutable objects (such as numbers) are compared by contents at the bit level. This function is sometimes called "egal". It always returns a `Bool` value.
**Examples**
```julia-repl
julia> a = [1, 2]; b = [1, 2];

julia> a == b
true

julia> a === b
false

julia> a === a
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L280-L303)
```julia
isa(x, type) -> Bool
```
Determine whether `x` is of the given `type`. Can also be used as an infix operator, e.g. `x isa type`.
**Examples**
```julia-repl
julia> isa(1, Int)
true

julia> isa(1, Matrix)
false

julia> isa(1, Char)
false

julia> isa(1, Number)
true

julia> 1 isa Number
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1991-L2014)
```julia
isequal(x, y) -> Bool
```
Similar to [`==`](../math/#Base.:==), except for the treatment of floating point numbers and of missing values. `isequal` treats all floating-point `NaN` values as equal to each other, treats `-0.0` as unequal to `0.0`, and [`missing`](../../manual/missing/#missing) as equal to `missing`. Always returns a `Bool` value.


## [All Objects](#All-Objects)
`isequal` is an equivalence relation - it is reflexive (`===` implies `isequal`), symmetric (`isequal(a, b)` implies `isequal(b, a)`) and transitive (`isequal(a, b)` and `isequal(b, c)` implies `isequal(a, c)`).
**Implementation**
The default implementation of `isequal` calls `==`, so a type that does not involve floating-point values generally only needs to define `==`.
`isequal` is the comparison function used by hash tables (`Dict`). `isequal(x,y)` must imply that `hash(x) == hash(y)`.
This typically means that types for which a custom `==` or `isequal` method exists must implement a corresponding [`hash`](#Base.hash) method (and vice versa). Collections typically implement `isequal` by calling `isequal` recursively on all contents.
Furthermore, `isequal` is linked with [`isless`](#Base.isless), and they work together to define a fixed total ordering, where exactly one of `isequal(x, y)`, `isless(x, y)`, or `isless(y, x)` must be `true` (and the other two `false`).
Scalar types generally do not need to implement `isequal` separate from `==`, unless they represent floating-point numbers amenable to a more efficient implementation than that provided as a generic fallback (based on `isnan`, `signbit`, and `==`).
**Examples**
```julia-repl
julia> isequal([1., NaN], [1., NaN])
true

julia> [1., NaN] == [1., NaN]
false

julia> 0.0 == -0.0
true

julia> isequal(0.0, -0.0)
false

julia> missing == missing
missing

julia> isequal(missing, missing)
true
```


## [All Objects](#All-Objects)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L82-L133)
```julia
isequal(x)
```
Create a function that compares its argument to `x` using [`isequal`](#Base.isequal), i.e. a function equivalent to `y -> isequal(y, x)`.
The returned function is of type `Base.Fix2{typeof(isequal)}`, which can be used to implement specialized methods.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L1146-L1154)
```julia
isless(x, y)
```
Test whether `x` is less than `y`, according to a fixed total order (defined together with [`isequal`](#Base.isequal)). `isless` is not defined for pairs `(x, y)` of all types. However, if it is defined, it is expected to satisfy the following:
-   If `isless(x, y)` is defined, then so is `isless(y, x)` and `isequal(x, y)`, and exactly one of those three yields `true`.
-   The relation defined by `isless` is transitive, i.e., `isless(x, y) && isless(y, z)` implies `isless(x, z)`.
Values that are normally unordered, such as `NaN`, are ordered after regular values. [`missing`](../../manual/missing/#missing) values are ordered last.
This is the default comparison used by [`sort!`](../sort/#Base.sort!).
**Implementation**


## [All Objects](#All-Objects)
Non-numeric types with a total order should implement this function. Numeric types only need to implement it if they have special values such as `NaN`. Types with a partial order should implement [`<`](../math/#Base.:%3C). See the documentation on [Alternate Orderings](../sort/#Alternate-Orderings) for how to define alternate ordering methods that can be used in sorting and related functions.
**Examples**
```julia-repl
julia> isless(1, 3)
true

julia> isless("Red", "Blue")
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L143-L175)
```julia
isunordered(x)
```
Return `true` if `x` is a value that is not orderable according to [`<`](../math/#Base.:%3C), such as `NaN` or `missing`.
The values that evaluate to `true` with this predicate may be orderable with respect to other orderings such as [`isless`](#Base.isless).
This function requires Julia 1.7 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L235-L246)
```julia
ifelse(condition::Bool, x, y)
```
Return `x` if `condition` is `true`, otherwise return `y`. This differs from `?` or `if` in that it is an ordinary function, so all the arguments are evaluated first. In some cases, using `ifelse` instead of an `if` statement can eliminate the branch in generated code and provide higher performance in tight loops.
**Examples**
```julia-repl
julia> ifelse(1 > 2, 1, 2)
2
```


## [All Objects](#All-Objects)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L782-L795)
```julia
typeassert(x, type)
```
Throw a [`TypeError`](#Core.TypeError) unless `x isa type`. The syntax `x::type` calls this function.
**Examples**
```julia-repl
julia> typeassert(2.5, Int)
ERROR: TypeError: in typeassert, expected Int64, got a value of type Float64
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3357-L3370)
```julia
typeof(x)
```
Get the concrete type of `x`.
See also [`eltype`](../collections/#Base.eltype).
**Examples**
```julia-repl
julia> a = 1//2;

julia> typeof(a)
Rational{Int64}

julia> M = [1 2; 3.5 4];

julia> typeof(M)
Matrix{Float64} (alias for Array{Float64, 2})
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2617-L2636)
```julia
tuple(xs...)
```
Construct a tuple of the given objects.
See also [`Tuple`](#Core.Tuple), [`ntuple`](#Base.ntuple), [`NamedTuple`](#Core.NamedTuple).
**Examples**
```julia-repl
julia> tuple(1, 'b', pi)
(1, 'b', π)

julia> ans === (1, 'b', π)
true

julia> Tuple(Real[1, 2, pi])  # takes a collection
(1, 2, π)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2300-L2318)
```julia
ntuple(f, n::Integer)
```
Create a tuple of length `n`, computing each element as `f(i)`, where `i` is the index of the element.
**Examples**


## [All Objects](#All-Objects)
```julia-repl
julia> ntuple(i -> 2*i, 4)
(2, 4, 6, 8)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ntuple.jl#L5-L16)
```julia
ntuple(f, ::Val{N})
```
Create a tuple of length `N`, computing each element as `f(i)`, where `i` is the index of the element. By taking a `Val(N)` argument, it is possible that this version of ntuple may generate more efficient code than the version taking the length as an integer. But `ntuple(f, N)` is preferable to `ntuple(f, Val(N))` in cases where `N` cannot be determined at compile time.
**Examples**
```julia-repl
julia> ntuple(i -> 2*i, Val(4))
(2, 4, 6, 8)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/ntuple.jl#L52-L68)
```julia
objectid(x) -> UInt
```
Get a hash value for `x` based on object identity.
If `x === y` then `objectid(x) == objectid(y)`, and usually when `x !== y`, `objectid(x) != objectid(y)`.
See also [`hash`](#Base.hash), [`IdDict`](../collections/#Base.IdDict).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L730-L738)
```julia
hash(x[, h::UInt]) -> UInt
```
Compute an integer hash code such that `isequal(x,y)` implies `hash(x)==hash(y)`. The optional second argument `h` is another hash code to be mixed with the result.


## [All Objects](#All-Objects)
New types should implement the 2-argument form, typically by calling the 2-argument `hash` method recursively in order to mix hashes of the contents with each other (and with `h`). Typically, any type that implements `hash` should also implement its own [`==`](../math/#Base.:==) (hence [`isequal`](#Base.isequal)) to guarantee the property mentioned above.
The hash value may change when a new Julia process is started.
```julia-repl
julia> a = hash(10)
0x95ea2955abd45275

julia> hash(10, a) # only use the output of another hash function as the second argument
0xd42bad54a8575b16
```
See also: [`objectid`](#Base.objectid), [`Dict`](../collections/#Base.Dict), [`Set`](../collections/#Base.Set).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/hashing.jl#L5-L27)
```julia
finalizer(f, x)
```
Register a function `f(x)` to be called when there are no program-accessible references to `x`, and return `x`. The type of `x` must be a `mutable struct`, otherwise the function will throw.
`f` must not cause a task switch, which excludes most I/O operations such as `println`. Using the `@async` macro (to defer context switching to outside of the finalizer) or `ccall` to directly invoke IO functions in C may be helpful for debugging purposes.
Note that there is no guaranteed world age for the execution of `f`. It may be called in the world age in which the finalizer was registered or any later world age.
**Examples**


## [All Objects](#All-Objects)
```julia
finalizer(my_mutable_struct) do x
    @async println("Finalizing $x.")
end

finalizer(my_mutable_struct) do x
    ccall(:jl_safe_printf, Cvoid, (Cstring, Cstring), "Finalizing %s.", repr(x))
end
```
A finalizer may be registered at object construction. In the following example note that we implicitly rely on the finalizer returning the newly created mutable struct `x`.
```julia
mutable struct MyMutableStruct
    bar
    function MyMutableStruct(bar)
        x = new(bar)
        f(t) = @async println("Finalizing $t.")
        finalizer(f, x)
    end
end
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L45-L83)
```julia
finalize(x)
```
Immediately run finalizers registered for object `x`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L97-L101)
```julia
copy(x)
```
Create a shallow copy of `x`: the outer structure is copied, but not all internal values. For example, copying an array produces a new array with identically-same elements as the original.
See also [`copy!`](../arrays/#Base.copy!), [`copyto!`](../c/#Base.copyto!), [`deepcopy`](#Base.deepcopy).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/array.jl#L334-L342)
```julia
deepcopy(x)
```


## [All Objects](#All-Objects)
Create a deep copy of `x`: everything is copied recursively, resulting in a fully independent object. For example, deep-copying an array creates deep copies of all the objects it contains and produces a new array with the consistent relationship structure (e.g., if the first two elements are the same object in the original array, the first two elements of the new array will also be the same `deepcopy`ed object). Calling `deepcopy` on an object should generally have the same effect as serializing and then deserializing it.
While it isn't normally necessary, user-defined types can override the default `deepcopy` behavior by defining a specialized version of the function `deepcopy_internal(x::T, dict::IdDict)` (which shouldn't otherwise be used), where `T` is the type to be specialized for, and `dict` keeps track of objects copied so far within the recursion. Within the definition, `deepcopy_internal` should be used in place of `deepcopy`, and the `dict` variable should be updated as appropriate before returning.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/deepcopy.jl#L8-L26)
```julia
getproperty(value, name::Symbol)
getproperty(value, name::Symbol, order::Symbol)
```
The syntax `a.b` calls `getproperty(a, :b)`. The syntax `@atomic order a.b` calls `getproperty(a, :b, :order)` and the syntax `@atomic a.b` calls `getproperty(a, :b, :sequentially_consistent)`.
**Examples**


## [All Objects](#All-Objects)
```julia-repl
julia> struct MyType{T <: Number}
           x::T
       end

julia> function Base.getproperty(obj::MyType, sym::Symbol)
           if sym === :special
               return obj.x + 1
           else # fallback to getfield
               return getfield(obj, sym)
           end
       end

julia> obj = MyType(1);

julia> obj.special
2

julia> obj.x
1
```
One should overload `getproperty` only when necessary, as it can be confusing if the behavior of the syntax `obj.f` is unusual. Also note that using methods is often preferable. See also this style guide documentation for more information: [Prefer exported methods over direct field access](../../manual/style-guide/#Prefer-exported-methods-over-direct-field-access).
See also [`getfield`](#Core.getfield), [`propertynames`](#Base.propertynames) and [`setproperty!`](#Base.setproperty!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3373-L3412)
```julia
setproperty!(value, name::Symbol, x)
setproperty!(value, name::Symbol, x, order::Symbol)
```
The syntax `a.b = c` calls `setproperty!(a, :b, c)`. The syntax `@atomic order a.b = c` calls `setproperty!(a, :b, c, :order)` and the syntax `@atomic a.b = c` calls `setproperty!(a, :b, c, :sequentially_consistent)`.
`setproperty!` on modules requires at least Julia 1.8.
See also [`setfield!`](#Core.setfield!), [`propertynames`](#Base.propertynames) and [`getproperty`](#Base.getproperty).


## [All Objects](#All-Objects)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3415-L3429)
```julia
replaceproperty!(x, f::Symbol, expected, desired, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)
```
Perform a compare-and-swap operation on `x.f` from `expected` to `desired`, per egal. The syntax `@atomicreplace x.f expected => desired` can be used instead of the function call form.
See also [`replacefield!`](#Core.replacefield!) [`setproperty!`](#Base.setproperty!), [`setpropertyonce!`](#Base.setpropertyonce!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3460-L3470)
```julia
swapproperty!(x, f::Symbol, v, order::Symbol=:not_atomic)
```
The syntax `@atomic a.b, _ = c, a.b` returns `(c, swapproperty!(a, :b, c, :sequentially_consistent))`, where there must be one `getproperty` expression common to both sides.
See also [`swapfield!`](#Core.swapfield!) and [`setproperty!`](#Base.setproperty!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3432-L3440)
```julia
modifyproperty!(x, f::Symbol, op, v, order::Symbol=:not_atomic)
```
The syntax `@atomic op(x.f, v)` (and its equivalent `@atomic x.f op v`) returns `modifyproperty!(x, :f, op, v, :sequentially_consistent)`, where the first argument must be a `getproperty` expression and is modified atomically.


## [All Objects](#All-Objects)
Invocation of `op(getproperty(x, f), v)` must return a value that can be stored in the field `f` of the object `x` by default. In particular, unlike the default behavior of [`setproperty!`](#Base.setproperty!), the `convert` function is not called automatically.
See also [`modifyfield!`](#Core.modifyfield!) and [`setproperty!`](#Base.setproperty!).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3443-L3457)
```julia
setpropertyonce!(x, f::Symbol, value, success_order::Symbol=:not_atomic, fail_order::Symbol=success_order)
```
Perform a compare-and-swap operation on `x.f` to set it to `value` if previously unset. The syntax `@atomiconce x.f = value` can be used instead of the function call form.
See also [`setfieldonce!`](#Core.replacefield!), [`setproperty!`](#Base.setproperty!), [`replaceproperty!`](#Base.replaceproperty!).
This function requires Julia 1.11 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3473-L3485)
```julia
propertynames(x, private=false)
```
Get a tuple or a vector of the properties (`x.property`) of an object `x`. This is typically the same as [`fieldnames(typeof(x))`](#Base.fieldnames), but types that overload [`getproperty`](#Base.getproperty) should generally overload `propertynames` as well to get the properties of an instance of the type.


## [All Objects](#All-Objects)
`propertynames(x)` may return only "public" property names that are part of the documented interface of `x`. If you want it to also return "private" property names intended for internal use, pass `true` for the optional second argument. REPL tab completion on `x.` shows only the `private=false` properties.
See also: [`hasproperty`](#Base.hasproperty), [`hasfield`](#Base.hasfield).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2595-L2609)
```julia
hasproperty(x, s::Symbol)
```
Return a boolean indicating whether the object `x` has `s` as one of its own properties.
This function requires at least Julia 1.2.
See also: [`propertynames`](#Base.propertynames), [`hasfield`](#Base.hasfield).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L2615-L2624)
```julia
getfield(value, name::Symbol, [order::Symbol])
getfield(value, i::Int, [order::Symbol])
```
Extract a field from a composite `value` by name or position. Optionally, an ordering can be defined for the operation. If the field was declared `@atomic`, the specification is strongly recommended to be compatible with the stores to that location. Otherwise, if not declared as `@atomic`, this parameter must be `:not_atomic` if specified. See also [`getproperty`](#Base.getproperty) and [`fieldnames`](#Base.fieldnames).
**Examples**
```julia-repl
julia> a = 1//2
1//2

julia> getfield(a, :num)
1

julia> a.num
1

julia> getfield(a, 1)
1
```


## [All Objects](#All-Objects)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2321-L2346)
```julia
setfield!(value, name::Symbol, x, [order::Symbol])
setfield!(value, i::Int, x, [order::Symbol])
```
Assign `x` to a named field in `value` of composite type. The `value` must be mutable and `x` must be a subtype of `fieldtype(typeof(value), name)`. Additionally, an ordering can be specified for this operation. If the field was declared `@atomic`, this specification is mandatory. Otherwise, if not declared as `@atomic`, it must be `:not_atomic` if specified. See also [`setproperty!`](#Base.setproperty!).
**Examples**
```julia-repl
julia> mutable struct MyMutableStruct
           field::Int
       end

julia> a = MyMutableStruct(1);

julia> setfield!(a, :field, 2);

julia> getfield(a, :field)
2

julia> a = 1//2
1//2

julia> setfield!(a, :num, 3);
ERROR: setfield!: immutable struct of type Rational cannot be changed
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2349-L2379)
```julia
modifyfield!(value, name::Symbol, op, x, [order::Symbol]) -> Pair
modifyfield!(value, i::Int, op, x, [order::Symbol]) -> Pair
```
Atomically perform the operations to get and set a field after applying the function `op`.
```julia
y = getfield(value, name)
z = op(y, x)
setfield!(value, name, z)
return y => z
```
If supported by the hardware (for example, atomic increment), this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.


## [All Objects](#All-Objects)
This function requires Julia 1.7 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2397-L2414)
```julia
replacefield!(value, name::Symbol, expected, desired,
              [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
replacefield!(value, i::Int, expected, desired,
              [success_order::Symbol, [fail_order::Symbol=success_order]) -> (; old, success::Bool)
```
Atomically perform the operations to get and conditionally set a field to a given value.
```julia
y = getfield(value, name, fail_order)
ok = y === expected
if ok
    setfield!(value, name, desired, success_order)
end
return (; old = y, success = ok)
```
If supported by the hardware, this may be optimized to the appropriate hardware instruction, otherwise it'll use a loop.
This function requires Julia 1.7 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2417-L2438)
```julia
swapfield!(value, name::Symbol, x, [order::Symbol])
swapfield!(value, i::Int, x, [order::Symbol])
```
Atomically perform the operations to simultaneously get and set a field:
```julia
y = getfield(value, name)
setfield!(value, name, x)
return y
```
This function requires Julia 1.7 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2382-L2394)


## [All Objects](#All-Objects)
```julia
setfieldonce!(value, name::Union{Int,Symbol}, desired,
              [success_order::Symbol, [fail_order::Symbol=success_order]) -> success::Bool
```
Atomically perform the operations to set a field to a given value, only if it was previously not set.
```julia
ok = !isdefined(value, name, fail_order)
if ok
    setfield!(value, name, desired, success_order)
end
return ok
```
This function requires Julia 1.11 or later.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2441-L2456)
```julia
isdefined(m::Module, s::Symbol, [order::Symbol])
isdefined(object, s::Symbol, [order::Symbol])
isdefined(object, index::Int, [order::Symbol])
```
Tests whether a global variable or object field is defined. The arguments can be a module and a symbol or a composite object and field name (as a symbol) or index. Optionally, an ordering can be defined for the operation. If the field was declared `@atomic`, the specification is strongly recommended to be compatible with the stores to that location. Otherwise, if not declared as `@atomic`, this parameter must be `:not_atomic` if specified.
To test whether an array element is defined, use [`isassigned`](../arrays/#Base.isassigned) instead.
See also [`@isdefined`](#Base.@isdefined).
**Examples**
```julia-repl
julia> isdefined(Base, :sum)
true

julia> isdefined(Base, :NonExistentMethod)
false

julia> a = 1//2;

julia> isdefined(a, 2)
true

julia> isdefined(a, 3)
false

julia> isdefined(a, :num)
true

julia> isdefined(a, :numerator)
false
```


## [All Objects](#All-Objects)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L2639-L2677)
```julia
@isdefined s -> Bool
```
Tests whether variable `s` is defined in the current scope.
See also [`isdefined`](#Core.isdefined) for field properties and [`isassigned`](../arrays/#Base.isassigned) for array indexes or [`haskey`](../collections/#Base.haskey) for other mappings.
**Examples**
```julia-repl
julia> @isdefined newvar
false

julia> newvar = 1
1

julia> @isdefined newvar
true

julia> function f()
           println(@isdefined x)
           x = 3
           println(@isdefined x)
       end
f (generic function with 1 method)

julia> f()
false
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L148-L178)
```julia
convert(T, x)
```
Convert `x` to a value of type `T`.
If `T` is an [`Integer`](../numbers/#Core.Integer) type, an [`InexactError`](#Core.InexactError) will be raised if `x` is not representable by `T`, for example if `x` is not integer-valued, or is outside the range supported by `T`.
**Examples**
```julia-repl
julia> convert(Int, 3.0)
3

julia> convert(Int, 3.5)
ERROR: InexactError: Int64(3.5)
Stacktrace:
[...]
```
If `T` is a [`AbstractFloat`](../numbers/#Core.AbstractFloat) type, then it will return the closest value to `x` representable by `T`. Inf is treated as one ulp greater than `floatmax(T)` for purposes of determining nearest.


## [All Objects](#All-Objects)
```julia-repl
julia> x = 1/3
0.3333333333333333

julia> convert(Float32, x)
0.33333334f0

julia> convert(BigFloat, x)
0.333333333333333314829616256247390992939472198486328125
```
If `T` is a collection type and `x` a collection, the result of `convert(T, x)` may alias all or part of `x`.
```julia-repl
julia> x = Int[1, 2, 3];

julia> y = convert(Vector{Int}, x);

julia> y === x
true
```
See also: [`round`](../math/#Base.round), [`trunc`](../math/#Base.trunc), [`oftype`](#Base.oftype), [`reinterpret`](../arrays/#Base.reinterpret).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L404-L451)
```julia
promote(xs...)
```
Convert all arguments to a common type, and return them all (as a tuple). If no arguments can be converted, an error is raised.
See also: [`promote_type`](#Base.promote_type), [`promote_rule`](#Base.promote_rule).
**Examples**
```julia-repl
julia> promote(Int8(1), Float16(4.5), Float32(4.1))
(1.0f0, 4.5f0, 4.1f0)

julia> promote_type(Int8, Float16, Float32)
Float32

julia> reduce(Base.promote_typejoin, (Int8, Float16, Float32))
Real

julia> promote(1, "x")
ERROR: promotion of types Int64 and String failed to change any arguments
[...]

julia> promote_type(Int, String)
Any
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/promotion.jl#L343-L369)
```julia
oftype(x, y)
```
Convert `y` to the type of `x` i.e. `convert(typeof(x), y)`.
**Examples**


## [All Objects](#All-Objects)
```julia-repl
julia> x = 4;

julia> y = 3.;

julia> oftype(x, y)
3

julia> oftype(y, x)
4.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L648-L665)
```julia
widen(x)
```
If `x` is a type, return a "larger" type, defined so that arithmetic operations `+` and `-` are guaranteed not to overflow nor lose precision for any combination of values that type `x` can hold.
For fixed-size integer types less than 128 bits, `widen` will return a type with twice the number of bits.
If `x` is a value, it is converted to `widen(typeof(x))`.
**Examples**
```julia-repl
julia> widen(Int32)
Int64

julia> widen(1.5f0)
1.5
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L879-L899)
```julia
identity(x)
```
The identity function. Returns its argument.
See also: [`one`](../numbers/#Base.one), [`oneunit`](../numbers/#Base.oneunit), and [`LinearAlgebra`](../../stdlib/LinearAlgebra/#man-linalg)'s `I`.
**Examples**
```julia-repl
julia> identity("Well, what did you expect?")
"Well, what did you expect?"
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L518-L530)
```julia
WeakRef(x)
```


## [All Objects](#All-Objects)
`w = WeakRef(x)` constructs a [weak reference](https://en.wikipedia.org/wiki/Weak_reference) to the Julia value `x`: although `w` contains a reference to `x`, it does not prevent `x` from being garbage collected. `w.value` is either `x` (if `x` has not been garbage-collected yet) or `nothing` (if `x` has been garbage-collected).
```julia-repl
julia> x = "a string"
"a string"

julia> w = WeakRef(x)
WeakRef("a string")

julia> GC.gc()

julia> w           # a reference is maintained via `x`
WeakRef("a string")

julia> x = nothing # clear reference

julia> GC.gc()

julia> w
WeakRef(nothing)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/gcutils.jl#L4-L31)


## [Properties of Types](#Properties-of-Types)


### [Type relations](#Type-relations)
```julia
supertype(T::DataType)
```
Return the supertype of DataType `T`.
**Examples**
```julia-repl
julia> supertype(Int32)
Signed
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L32-L42)
```julia
Core.Type{T}
```
`Core.Type` is an abstract type which has all type objects as its instances. The only instance of the singleton type `Core.Type{T}` is the object `T`.
**Examples**
```julia-repl
julia> isa(Type{Float64}, Type)
true

julia> isa(Float64, Type)
true

julia> isa(Real, Type{Float64})
false

julia> isa(Real, Type{Real})
true
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1559-L1580)
```julia
DataType <: Type{T}
```
`DataType` represents explicitly declared types that have names, explicitly declared supertypes, and, optionally, parameters. Every concrete value in the system is an instance of some `DataType`.
**Examples**
```julia-repl
julia> typeof(Real)
DataType

julia> typeof(Int)
DataType

julia> struct Point
           x::Int
           y
       end

julia> typeof(Point)
DataType
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1583-L1606)
```julia
<:(T1, T2)
```
Subtype operator: returns `true` if and only if all values of type `T1` are also of type `T2`.
**Examples**
```julia-repl
julia> Float64 <: AbstractFloat
true

julia> Vector{Int} <: AbstractArray
true

julia> Matrix{Float64} <: Matrix{AbstractFloat}
false
```


### [Type relations](#Type-relations)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L5-L22)
```julia
>:(T1, T2)
```
Supertype operator, equivalent to `T2 <: T1`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/operators.jl#L25-L29)
```julia
typejoin(T, S, ...)
```
Return the closest common ancestor of types `T` and `S`, i.e. the narrowest type from which they both inherit. Recurses on additional varargs.
**Examples**
```julia-repl
julia> typejoin(Int, Float64)
Real

julia> typejoin(Int, Float64, ComplexF32)
Number
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/promotion.jl#L5-L19)
```julia
typeintersect(T::Type, S::Type)
```
Compute a type that contains the intersection of `T` and `S`. Usually this will be the smallest such type or one close to it.
A special case where exact behavior is guaranteed: when `T <: S`, `typeintersect(S, T) == T == typeintersect(T, S)`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L887-L895)
```julia
promote_type(type1, type2, ...)
```


### [Type relations](#Type-relations)
Promotion refers to converting values of mixed types to a single common type. `promote_type` represents the default promotion behavior in Julia when operators (usually mathematical) are given arguments of differing types. `promote_type` generally tries to return a type which can at least approximate most values of either input type without excessively widening. Some loss is tolerated; for example, `promote_type(Int64, Float64)` returns [`Float64`](../numbers/#Core.Float64) even though strictly, not all [`Int64`](../numbers/#Core.Int64) values can be represented exactly as `Float64` values.
See also: [`promote`](#Base.promote), [`promote_typejoin`](#Base.promote_typejoin), [`promote_rule`](#Base.promote_rule).
**Examples**
```julia-repl
julia> promote_type(Int64, Float64)
Float64

julia> promote_type(Int32, Int64)
Int64

julia> promote_type(Float32, BigInt)
BigFloat

julia> promote_type(Int16, Float16)
Float16

julia> promote_type(Int64, Float16)
Float16

julia> promote_type(Int8, UInt16)
UInt16
```
To overload promotion for your own types you should overload [`promote_rule`](#Base.promote_rule). `promote_type` calls `promote_rule` internally to determine the type. Overloading `promote_type` directly can cause ambiguity errors.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/promotion.jl#L259-L298)
```julia
promote_rule(type1, type2)
```


### [Type relations](#Type-relations)
Specifies what type should be used by [`promote`](#Base.promote) when given values of types `type1` and `type2`. This function should not be called directly, but should have definitions added to it for new types as appropriate.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/promotion.jl#L321-L327)
```julia
promote_typejoin(T, S)
```
Compute a type that contains both `T` and `S`, which could be either a parent of both types, or a `Union` if appropriate. Falls back to [`typejoin`](#Base.typejoin).
See instead [`promote`](#Base.promote), [`promote_type`](#Base.promote_type).
**Examples**
```julia-repl
julia> Base.promote_typejoin(Int, Float64)
Real

julia> Base.promote_type(Int, Float64)
Float64
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/promotion.jl#L156-L173)
```julia
isdispatchtuple(T)
```
Determine whether type `T` is a tuple "leaf type", meaning it could appear as a type signature in dispatch and has no subtypes (or supertypes) which could appear in a call. If `T` is not a type, then return `false`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L744-L751)


### [Declared structure](#Declared-structure)
```julia
ismutable(v) -> Bool
```
Return `true` if and only if value `v` is mutable. See [Mutable Composite Types](../../manual/types/#Mutable-Composite-Types) for a discussion of immutability. Note that this function works on values, so if you give it a `DataType`, it will tell you that a value of the type is mutable.
For technical reasons, `ismutable` returns `true` for values of certain special types (for example `String` and `Symbol`) even though they cannot be mutated in a permissible way.
See also [`isbits`](#Base.isbits), [`isstructtype`](#Base.isstructtype).
**Examples**
```julia-repl
julia> ismutable(1)
false

julia> ismutable([1,2])
true
```
This function requires at least Julia 1.5.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L619-L643)
```julia
isimmutable(v) -> Bool
```
Consider using `!ismutable(v)` instead, as `isimmutable(v)` will be replaced by `!ismutable(v)` in a future release. (Since Julia 1.5)
Return `true` iff value `v` is immutable. See [Mutable Composite Types](../../manual/types/#Mutable-Composite-Types) for a discussion of immutability. Note that this function works on values, so if you give it a type, it will tell you that a value of `DataType` is mutable.
**Examples**
```julia-repl
julia> isimmutable(1)
true

julia> isimmutable([1,2])
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/deprecated.jl#L255-L271)
```julia
ismutabletype(T) -> Bool
```


### [Declared structure](#Declared-structure)
Determine whether type `T` was declared as a mutable type (i.e. using `mutable struct` keyword). If `T` is not a type, then return `false`.
This function requires at least Julia 1.7.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L648-L657)
```julia
isabstracttype(T)
```
Determine whether type `T` was declared as an abstract type (i.e. using the `abstract type` syntax). Note that this is not the negation of `isconcretetype(T)`. If `T` is not a type, then return `false`.
**Examples**
```julia-repl
julia> isabstracttype(AbstractArray)
true

julia> isabstracttype(Vector)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L843-L859)
```julia
isprimitivetype(T) -> Bool
```
Determine whether type `T` was declared as a primitive type (i.e. using the `primitive type` syntax). If `T` is not a type, then return `false`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L682-L688)
```julia
Base.issingletontype(T)
```
Determine whether type `T` has exactly one possible instance; for example, a struct type with no fields except other singleton values. If `T` is not a concrete type, then return `false`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L878-L884)
```julia
isstructtype(T) -> Bool
```


### [Declared structure](#Declared-structure)
Determine whether type `T` was declared as a struct type (i.e. using the `struct` or `mutable struct` keyword). If `T` is not a type, then return `false`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L667-L673)
```julia
nameof(t::DataType) -> Symbol
```
Get the name of a (potentially `UnionAll`-wrapped) `DataType` (without its parent module) as a symbol.
**Examples**
```julia-repl
julia> module Foo
           struct S{T}
           end
       end
Foo

julia> nameof(Foo.S{T} where T)
:S
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L283-L300)
```julia
fieldnames(x::DataType)
```
Get a tuple with the names of the fields of a `DataType`.
See also [`propertynames`](#Base.propertynames), [`hasfield`](#Base.hasfield).
**Examples**
```julia-repl
julia> fieldnames(Rational)
(:num, :den)

julia> fieldnames(typeof(1+im))
(:re, :im)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L235-L250)
```julia
fieldname(x::DataType, i::Integer)
```
Get the name of field `i` of a `DataType`.
**Examples**
```julia-repl
julia> fieldname(Rational, 1)
:num

julia> fieldname(Rational, 2)
:den
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L201-L214)
```julia
fieldtype(T, name::Symbol | index::Int)
```
Determine the declared type of a field (specified by name or index) in a composite DataType `T`.


### [Declared structure](#Declared-structure)
**Examples**
```julia-repl
julia> struct Foo
           x::Int64
           y::String
       end

julia> fieldtype(Foo, :x)
Int64

julia> fieldtype(Foo, 2)
String
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L928-L946)
```julia
fieldtypes(T::Type)
```
The declared types of all fields in a composite DataType `T` as a tuple.
This function requires at least Julia 1.1.
**Examples**
```julia-repl
julia> struct Foo
           x::Int64
           y::String
       end

julia> fieldtypes(Foo)
(Int64, String)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1050-L1068)
```julia
fieldcount(t::Type)
```
Get the number of fields that an instance of the given type would have. An error is thrown if the type is too abstract to determine this.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1024-L1029)
```julia
hasfield(T::Type, name::Symbol)
```
Return a boolean indicating whether `T` has `name` as one of its own fields.
See also [`fieldnames`](#Base.fieldnames), [`fieldcount`](#Base.fieldcount), [`hasproperty`](#Base.hasproperty).
This function requires at least Julia 1.2.
**Examples**
```julia-repl
julia> struct Foo
            bar::Int
       end

julia> hasfield(Foo, :bar)
true

julia> hasfield(Foo, :x)
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L258-L280)


### [Declared structure](#Declared-structure)
```julia
nfields(x) -> Int
```
Get the number of fields in the given object.
**Examples**
```julia-repl
julia> a = 1//2;

julia> nfields(a)
2

julia> b = 1
1

julia> nfields(b)
0

julia> ex = ErrorException("I've done a bad thing");

julia> nfields(ex)
1
```
In these examples, `a` is a [`Rational`](../numbers/#Base.Rational), which has two fields. `b` is an `Int`, which is a primitive bitstype with no fields at all. `ex` is an [`ErrorException`](#Core.ErrorException), which has one field.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L1819-L1846)
```julia
isconst(m::Module, s::Symbol) -> Bool
```
Determine whether a global is declared `const` in a given module `m`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L326-L330)
```julia
isconst(t::DataType, s::Union{Int,Symbol}) -> Bool
```
Determine whether a field `s` is declared `const` in a given type `t`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L338-L342)
```julia
isfieldatomic(t::DataType, s::Union{Int,Symbol}) -> Bool
```
Determine whether a field `s` is declared `@atomic` in a given type `t`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L362-L366)


### [Memory layout](#Memory-layout)
```julia
sizeof(T::DataType)
sizeof(obj)
```
Size, in bytes, of the canonical binary representation of the given `DataType` `T`, if any. Or the size, in bytes, of object `obj` if it is not a `DataType`.
See also [`Base.summarysize`](#Base.summarysize).
**Examples**
```julia-repl
julia> sizeof(Float32)
4

julia> sizeof(ComplexF64)
16

julia> sizeof(1.0)
8

julia> sizeof(collect(1.0:10.0))
80

julia> struct StructWithPadding
           x::Int64
           flag::Bool
       end

julia> sizeof(StructWithPadding) # not the sum of `sizeof` of fields due to padding
16

julia> sizeof(Int64) + sizeof(Bool) # different from above
9
```
If `DataType` `T` does not have a specific size, an error is thrown.
```julia-repl
julia> sizeof(AbstractArray)
ERROR: Abstract type AbstractArray does not have a definite size.
Stacktrace:
[...]
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/essentials.jl#L736-L779)
```julia
isconcretetype(T)
```
Determine whether type `T` is a concrete type, meaning it could have direct instances (values `x` such that `typeof(x) === T`). Note that this is not the negation of `isabstracttype(T)`. If `T` is not a type, then return `false`.
See also: [`isbits`](#Base.isbits), [`isabstracttype`](#Base.isabstracttype), [`issingletontype`](#Base.issingletontype).
**Examples**


### [Memory layout](#Memory-layout)
```julia-repl
julia> isconcretetype(Complex)
false

julia> isconcretetype(Complex{Float32})
true

julia> isconcretetype(Vector{Complex})
true

julia> isconcretetype(Vector{Complex{Float32}})
true

julia> isconcretetype(Union{})
false

julia> isconcretetype(Union{Int,String})
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L810-L840)
```julia
isbits(x)
```
Return `true` if `x` is an instance of an [`isbitstype`](#Base.isbitstype) type.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L723-L727)
```julia
isbitstype(T)
```
Return `true` if type `T` is a "plain data" type, meaning it is immutable and contains no references to other values, only `primitive` types and other `isbitstype` types. Typical examples are numeric types such as [`UInt8`](../numbers/#Core.UInt8), [`Float64`](../numbers/#Core.Float64), and [`Complex{Float64}`](../numbers/#Base.Complex). This category of types is significant since they are valid as type parameters, may not track [`isdefined`](#Core.isdefined) / [`isassigned`](../arrays/#Base.isassigned) status, and have a defined layout that is compatible with C. If `T` is not a type, then return `false`.
See also [`isbits`](#Base.isbits), [`isprimitivetype`](#Base.isprimitivetype), [`ismutable`](#Base.ismutable).
**Examples**
```julia-repl
julia> isbitstype(Complex{Float64})
true

julia> isbitstype(Complex)
false
```


### [Memory layout](#Memory-layout)
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L697-L720)
```julia
fieldoffset(type, i)
```
The byte offset of field `i` of a type relative to the data start. For example, we could use it in the following manner to summarize information about a struct:
```julia-repl
julia> structinfo(T) = [(fieldoffset(T,i), fieldname(T,i), fieldtype(T,i)) for i = 1:fieldcount(T)];

julia> structinfo(Base.Filesystem.StatStruct)
13-element Vector{Tuple{UInt64, Symbol, Type}}:
 (0x0000000000000000, :desc, Union{RawFD, String})
 (0x0000000000000008, :device, UInt64)
 (0x0000000000000010, :inode, UInt64)
 (0x0000000000000018, :mode, UInt64)
 (0x0000000000000020, :nlink, Int64)
 (0x0000000000000028, :uid, UInt64)
 (0x0000000000000030, :gid, UInt64)
 (0x0000000000000038, :rdev, UInt64)
 (0x0000000000000040, :size, Int64)
 (0x0000000000000048, :blksize, Int64)
 (0x0000000000000050, :blocks, Int64)
 (0x0000000000000058, :mtime, Float64)
 (0x0000000000000060, :ctime, Float64)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L900-L925)
```julia
Base.datatype_alignment(dt::DataType) -> Int
```
Memory allocation minimum alignment for instances of this type. Can be called on any `isconcretetype`, although for Memory it will give the alignment of the elements, not the whole object.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L442-L448)


### [Memory layout](#Memory-layout)
```julia
Base.datatype_haspadding(dt::DataType) -> Bool
```
Return whether the fields of instances of this type are packed in memory, with no intervening padding bits (defined as bits whose value does not uniquely impact the egal test when applied to the struct fields). Can be called on any `isconcretetype`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L485-L492)
```julia
Base.datatype_pointerfree(dt::DataType) -> Bool
```
Return whether instances of this type can contain references to gc-managed memory. Can be called on any `isconcretetype`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L524-L529)


### [Special values](#Special-values)
```julia
typemin(T)
```
The lowest value representable by the given (real) numeric DataType `T`.
See also: [`floatmin`](#Base.floatmin), [`typemax`](#Base.typemax), [`eps`](#Base.eps-Tuple%7BType%7B%3C:AbstractFloat%7D%7D).
**Examples**
```julia-repl
julia> typemin(Int8)
-128

julia> typemin(UInt32)
0x00000000

julia> typemin(Float16)
-Inf16

julia> typemin(Float32)
-Inf32

julia> nextfloat(-Inf32)  # smallest finite Float32 floating point number
-3.4028235f38
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/int.jl#L750-L774)
```julia
typemax(T)
```
The highest value representable by the given (real) numeric `DataType`.
See also: [`floatmax`](#Base.floatmax), [`typemin`](#Base.typemin), [`eps`](#Base.eps-Tuple%7BType%7B%3C:AbstractFloat%7D%7D).
**Examples**
```julia-repl
julia> typemax(Int8)
127

julia> typemax(UInt32)
0xffffffff

julia> typemax(Float64)
Inf

julia> typemax(Float32)
Inf32

julia> floatmax(Float32)  # largest finite Float32 floating point number
3.4028235f38
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/int.jl#L777-L801)
```julia
floatmin(T = Float64)
```
Return the smallest positive normal number representable by the floating-point type `T`.
**Examples**
```julia-repl
julia> floatmin(Float16)
Float16(6.104e-5)

julia> floatmin(Float32)
1.1754944f-38

julia> floatmin()
2.2250738585072014e-308
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/float.jl#L1066-L1083)


### [Special values](#Special-values)
```julia
floatmax(T = Float64)
```
Return the largest finite number representable by the floating-point type `T`.
See also: [`typemax`](#Base.typemax), [`floatmin`](#Base.floatmin), [`eps`](#Base.eps-Tuple%7BType%7B%3C:AbstractFloat%7D%7D).
**Examples**
```julia-repl
julia> floatmax(Float16)
Float16(6.55e4)

julia> floatmax(Float32)
3.4028235f38

julia> floatmax()
1.7976931348623157e308

julia> typemax(Float64)
Inf
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/float.jl#L1086-L1107)
```julia
maxintfloat(T=Float64)
```
The largest consecutive integer-valued floating-point number that is exactly represented in the given floating-point type `T` (which defaults to `Float64`).
That is, `maxintfloat` returns the smallest positive integer-valued floating-point number `n` such that `n+1` is *not* exactly representable in the type `T`.
When an `Integer`-type value is needed, use `Integer(maxintfloat(T))`.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/floatfuncs.jl#L19-L29)
```julia
maxintfloat(T, S)
```
The largest consecutive integer representable in the given floating-point type `T` that also does not exceed the maximum integer representable by the integer type `S`. Equivalently, it is the minimum of `maxintfloat(T)` and [`typemax(S)`](#Base.typemax).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/floatfuncs.jl#L35-L41)
```julia
eps(::Type{T}) where T<:AbstractFloat
eps()
```


### [Special values](#Special-values)
Return the *machine epsilon* of the floating point type `T` (`T = Float64` by default). This is defined as the gap between 1 and the next largest value representable by `typeof(one(T))`, and is equivalent to `eps(one(T))`. (Since `eps(T)` is a bound on the *relative error* of `T`, it is a "dimensionless" quantity like [`one`](../numbers/#Base.one).)
**Examples**
```julia-repl
julia> eps()
2.220446049250313e-16

julia> eps(Float32)
1.1920929f-7

julia> 1.0 + eps()
1.0000000000000002

julia> 1.0 + eps()/2
1.0
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/float.jl#L1113-L1136)
```julia
eps(x::AbstractFloat)
```
Return the *unit in last place* (ulp) of `x`. This is the distance between consecutive representable floating point values at `x`. In most cases, if the distance on either side of `x` is different, then the larger of the two is taken, that is
```julia
eps(x) == max(x-prevfloat(x), nextfloat(x)-x)
```
The exceptions to this rule are the smallest and largest finite values (e.g. `nextfloat(-Inf)` and `prevfloat(Inf)` for [`Float64`](../numbers/#Core.Float64)), which round to the smaller of the values.
The rationale for this behavior is that `eps` bounds the floating point rounding error. Under the default `RoundNearest` rounding mode, if $y$ is a real number and $x$ is the nearest floating point number to $y$, then
\\\[\|y-x\| \\leq \\operatorname{eps}(x)/2.\\\]


### [Special values](#Special-values)
See also: [`nextfloat`](../numbers/#Base.nextfloat), [`issubnormal`](../numbers/#Base.issubnormal), [`floatmax`](#Base.floatmax).
**Examples**
```julia-repl
julia> eps(1.0)
2.220446049250313e-16

julia> eps(prevfloat(2.0))
2.220446049250313e-16

julia> eps(2.0)
4.440892098500626e-16

julia> x = prevfloat(Inf)      # largest finite Float64
1.7976931348623157e308

julia> x + eps(x)/2            # rounds up
Inf

julia> x + prevfloat(eps(x)/2) # rounds down
1.7976931348623157e308
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/float.jl#L1139-L1182)
```julia
instances(T::Type)
```
Return a collection of all instances of the given type, if applicable. Mostly used for enumerated types (see `@enum`).
**Examples**
```julia-repl
julia> @enum Color red blue green

julia> instances(Color)
(red, blue, green)
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/reflection.jl#L1073-L1086)


## [Special Types](#Special-Types)
```julia
Any::DataType
```
`Any` is the union of all types. It has the defining property `isa(x, Any) == true` for any `x`. `Any` therefore describes the entire universe of possible values. For example `Integer` is a subset of `Any` that includes `Int`, `Int8`, and other integer types.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3134-L3140)
```julia
Union{Types...}
```
A `Union` type is an abstract type which includes all instances of any of its argument types. This means that `T <: Union{T,S}` and `S <: Union{T,S}`.
Like other abstract types, it cannot be instantiated, even if all of its arguments are non abstract.
**Examples**
```julia-repl
julia> IntOrString = Union{Int,AbstractString}
Union{Int64, AbstractString}

julia> 1 isa IntOrString # instance of Int is included in the union
true

julia> "Hello!" isa IntOrString # String is also included
true

julia> 1.0 isa IntOrString # Float64 is not included because it is neither Int nor AbstractString
false
```
**Extended Help**
Unlike most other parametric types, unions are covariant in their parameters. For example, `Union{Real, String}` is a subtype of `Union{Number, AbstractString}`.
The empty union [`Union{}`](#Union%7B%7D) is the bottom type of Julia.
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3158-L3188)
```julia
Union{}
```


## [Special Types](#Special-Types)
`Union{}`, the empty [`Union`](#Core.Union) of types, is the type that has no values. That is, it has the defining property `isa(x, Union{}) == false` for any `x`. `Base.Bottom` is defined as its alias and the type of `Union{}` is `Core.TypeofBottom`.
**Examples**
```julia-repl
julia> isa(nothing, Union{})
false
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3143-L3155)
```julia
UnionAll
```
A union of types over all values of a type parameter. `UnionAll` is used to describe parametric types where the values of some parameters are not known. See the manual section on [UnionAll Types](../../manual/types/#UnionAll-Types).
**Examples**
```julia-repl
julia> typeof(Vector)
UnionAll

julia> typeof(Vector{Int})
DataType
```
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3192-L3206)
```julia
Tuple{Types...}
```
A tuple is a fixed-length container that can hold any values of different types, but cannot be modified (it is immutable). The values can be accessed via indexing. Tuple literals are written with commas and parentheses:
```julia-repl
julia> (1, 1+1)
(1, 2)

julia> (1,)
(1,)

julia> x = (0.0, "hello", 6*7)
(0.0, "hello", 42)

julia> x[2]
"hello"

julia> typeof(x)
Tuple{Float64, String, Int64}
```
A length-1 tuple must be written with a comma, `(1,)`, since `(1)` would just be a parenthesized value. `()` represents the empty (length-0) tuple.


## [Special Types](#Special-Types)
A tuple can be constructed from an iterator by using a `Tuple` type as constructor:
```julia-repl
julia> Tuple(["a", 1])
("a", 1)

julia> Tuple{String, Float64}(["a", 1])
("a", 1.0)
```
Tuple types are covariant in their parameters: `Tuple{Int}` is a subtype of `Tuple{Any}`. Therefore `Tuple{Any}` is considered an abstract type, and tuple types are only concrete if their parameters are. Tuples do not have field names; fields are only accessed by index. Tuple types may have any number of parameters.
See the manual section on [Tuple Types](../../manual/types/#Tuple-Types).
See also [`Vararg`](#Core.Vararg), [`NTuple`](#Core.NTuple), [`ntuple`](#Base.ntuple), [`tuple`](#Core.tuple), [`NamedTuple`](#Core.NamedTuple).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/docs/basedocs.jl#L3275-L3320)
```julia
NTuple{N, T}
```
A compact way of representing the type for a tuple of length `N` where all elements are of type `T`.
**Examples**
```julia-repl
julia> isa((1, 2, 3, 4, 5, 6), NTuple{6, Int})
true
```
See also [`ntuple`](#Base.ntuple).
[source](https://github.com/JuliaLang/julia/blob/9615af0f269df4d371b8010e9507ed5bae86103b/base/tuple.jl#L4-L16)
```julia
NamedTuple
```
`NamedTuple`s are, as their name suggests, named [`Tuple`](#Core.Tuple)s. That is, they're a tuple-like collection of values, where each entry has a unique name, represented as a [`Symbol`](#Core.Symbol). Like `Tuple`s, `NamedTuple`s are immutable; neither the names nor the values can be modified in place after construction.


## [Special Types](#Special-Types)
A named tuple can be created as a tuple literal with keys, e.g. `(a=1, b=2)`, or as a tuple literal with semicolon after the opening parenthesis, e.g. `(; a=1, b=2)` (this form also accepts programmatically generated names as described below), or using a `NamedTuple` type as constructor, e.g. `NamedTuple{(:a, :b)}((1,2))`.
Accessing the value associated with a name in a named tuple can be done using field access syntax, e.g. `x.a`, or using [`getindex`](../collections/#Base.getindex), e.g. `x[:a]` or `x[(:a, :b)]`. A tuple of the names can be obtained using [`keys`](../collections/#Base.keys), and a tuple of the values can be obtained using [`values`](../collections/#Base.values).
Iteration over `NamedTuple`s produces the *values* without the names. (See example below.) To iterate over the name-value pairs, use the [`pairs`](../collections/#Base.pairs) function.
The [`@NamedTuple`](#Base.@NamedTuple) macro can be used for conveniently declaring `NamedTuple` types.
**Examples**
```julia-repl
julia> x = (a=1, b=2)
(a = 1, b = 2)

julia> x.a
1

julia> x[:a]
1

julia> x[(:a,)]
(a = 1,)

julia> keys(x)
(:a, :b)

julia> values(x)
(1, 2)

julia> collect(x)
2-element Vector{Int64}:
 1
 2

julia> collect(pairs(x))
2-element Vector{Pair{Symbol, Int64}}:
 :a => 1
 :b => 2
```
In a similar fashion as to how one can define keyword arguments programmatically, a named tuple can be created by giving pairs `name::Symbol => value` after a semicolon inside a tuple literal. This and the `name=value` syntax can be mixed: