mercredi 23 janvier 2019

Fails to provide a default value for the 3rd argument in Ruby

def input_to_index(space)
  input = space.to_i - 1
end    

def move(board, index, character = "X")
  input_to_index(board)
  return board
end

I'm working through a beginner ruby course online and the code above returns an error saying that the 3rd argument isn't given a default value of string X.

Am I missing something simple here???

I've been going crazy trying to solve this.

Thanks!

Aucun commentaire:

Enregistrer un commentaire