Why can interactive Ruby run a program, but sublime editor not? -


i wrote code this:

class animal     attr_accessor :name, :color, :age  end first_animal = animal.new   first_animal.name  = "floyd" first_animal.color = "white" first_animal.age = 7 puts first_animal.name 

when save , drag onto "command prompt ruby" , press enter, says undefined local variable, when write code using interactive ruby (irb terminal) works fine. shows me results of first_animal.name etc. problem?

you have syntax mistake:

animal.new instead of animal.new


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -