..  isimmutable(v)

Return ``true`` iff value ``v`` is immutable.  See :ref:`man-immutable-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.


The isimmutable function in Julia is used to determine whether a given value is immutable or not. It returns true if the value is immutable, and false otherwise. Here are some examples of how to use the isimmutable function:

  1. Check if an integer is immutable:

    julia> isimmutable(5)

    The isimmutable function returns true for immutable values like integers.

  2. Check if a string is immutable:

    julia> isimmutable("Julia")

    Strings are immutable in Julia, so the isimmutable function returns true for them.

  3. Check if an array is immutable:

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

    Arrays are mutable in Julia, so the isimmutable function returns false for them.

  4. Check if a custom composite type is immutable:

    julia> struct Person
    julia> isimmutable(Person("Alice", 25))

    Custom composite types are mutable by default unless explicitly defined as immutable. In this example, the isimmutable function returns false for the Person object.

Please note that the isimmutable function works on values, not types. If you provide a type to the function, it will tell you that a value of that type is mutable.

See Also

BigFloat, BigInt, Dict, eltype, fieldtype, Float32, Float64, IntSet, isa, isalnum, isalpha, isascii, iseltype, isequal, isgraph, isimmutable, isinteractive, isleaftype, isnull, ispunct, isspace, issubtype, keytype, Nullable, NullException, promote_type, typeintersect, typejoin, typemax, typemin, typeof, Val, valtype,

User Contributed Notes

Add a Note

The format of note supported is markdown, use triple backtick to start and end a code block.

*Required Field

Checking you are not a robot: