Need help on multiple choice quiz program - SOLVED

Thank you. Problem solved.

I suspect your problem is the score variable, which you use within the ans function, but it is declared outside. (The error message should tell you the variable that is undefined.)

There are several possible solutions. Probably the easiest is to pass the current value of score to ans as well as the correct answer x and have it return the new value of score, so you would call it like:

score = ans(x, score)

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs