dump

dump(x)

Show all user-visible structure of a value.

Examples

julia> struct Point
           x::Int
           y::Int
       end

julia> p = Point(3, 4)
Point(3, 4)

julia> dump(p)
Point
  x: Int64 3
  y: Int64 4

In the above example, we define a Point struct with x and y fields. Then, we create an instance p of the Point struct with values (3, 4). The dump function is used to display the internal structure of the object p.

Common mistake example:

julia> dump(5)
ERROR: ArgumentError: `dump` requires a mutable struct or mutable struct instance as an argument

In this example, the dump function is used on an immutable value (integer 5). The dump function expects a mutable struct or instance, so it cannot be used on immutable values.

Note: The dump function is commonly used for debugging and introspection purposes to inspect the internal structure of objects. It is particularly useful when working with complex data structures or user-defined types.

See Also

:@printf, :@sprintf, display, displayable, dump, info, isprint, print, println, print_escaped, print_joined, print_shortest, print_unescaped, print_with_color, pushdisplay, redisplay, show, showall, showcompact, sprint, versioninfo,

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
Details

Checking you are not a robot: