show

show(x)

Write an informative text representation of a value to the current output stream. New types should overload show(io, x) where the first argument is a stream. The representation used by show generally includes Julia-specific formatting and type information.

Examples

julia> show(10)
10

julia> show("Hello, Julia!")
"Hello, Julia!"

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

The show function is used to generate an informative text representation of a value and output it to the current output stream. It is commonly used to display the value of an object or variable in a human-readable format. The representation generated by show often includes specific formatting and type information relevant to Julia.

Here are some examples demonstrating the usage of show:

  1. Show an integer value:

    julia> show(10)
    10

    The show function outputs the integer value 10 to the current output stream.

  2. Show a string value:

    julia> show("Hello, Julia!")
    "Hello, Julia!"

    In this example, show generates a text representation of the string "Hello, Julia!" and outputs it to the output stream.

  3. Show an array:
    julia> show([1, 2, 3])
    [1, 2, 3]

    The show function can be used to display the contents of an array. In this case, it outputs the array [1, 2, 3].

Note that for new types, it is possible to define a custom show method that overloads show(io, x), where io is the output stream and x is the object being displayed. This allows developers to define a custom representation for their own types.

Please make sure to refer to the official Julia documentation for more detailed information on the show function and its usage.

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: