What are Symbols for?

Today I came across the Symbol type, but I don’t understand what it’s for. The online documenation offers these two examples:

julia> :name

julia> typeof(:name)

julia> x = 42

julia> eval(:x)

and when I search the help menu in the REPL I see these two examples:

  julia> Symbol("my", "name")
  julia> Symbol("day", 4)

All of the examples above show syntax, but it’s unclear when any of the cases above might be useful for anything.

When might anyone ever use :myname or :day4 or eval(:x)?

1 Like

check this out, it is a good overview What is a "symbol" in Julia? - Stack Overflow