conditional.rb:2:in `<main>': undefined local variable or method `green' for main:Object (NameError)



  • Ruby gives you a clue. Something to do with the green

    doornumber=215
    doorcolour="green"
    
    if doornumber < 100 || doorcolour == green
       puts "That's the post delivered to the wrong house pat!"
    end
    

    It's missing the double quotes around the green, it should read doorcolour == "green"


Log in to reply
 

© Lightnetics 2024