Symbols
A symbol is a lightweight unchangeable name like :ok. Symbols are used as hash keys.
Example
a = :ok
b = :ok
puts a.equal?(b), a.to_s, "ok".to_sym.inspect
puts %i[a b c].inspectResult
true ok :ok [:a, :b, :c]
Exercise
Convert to symbol.
"ok".Quiz Test
These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.