mercredi 7 août 2019

undefined local variable or method `randNum' for main:Object (NameError), Thoughts? new to ruby

Not sure how randNum is undefined here.

class random
  randNum = rand(1)
  randNum2 = rand(1)
end

if randNum == randNum2
  puts("the numbers you rolled matched")
else
  puts("the numbers you rolled did not match")
end

<main>': undefined local variable or methodrandNum' for main:Object (NameError) Did you mean? rand




Aucun commentaire:

Enregistrer un commentaire