fork(1) download
  1. # works
  2. a = [2, 1, 3]
  3. a.sort! # notice the !
  4. print a
  5.  
  6. #doesn't work
  7. a = "symbols"
  8. a.to_sym! # notice the !
  9. print a
Runtime error #stdin #stdout #stderr 0.01s 7416KB
stdin
Standard input is empty
stdout
[1, 2, 3]
stderr
prog.rb:8:in `<main>': undefined method `to_sym!' for "symbols":String (NoMethodError)