Hi, everyone. I am new to Ruby. I am trying to write a hangman programme where a user is presented with is presented with blanks. As they correctly guess a letter, the letter will replace the blank. I have written most of the programme, but cannot work out how to replace the blank with the correctly guessed letter. Can anyone help with this please? Code pasted below, thank you.
The purpose of the programme is to enable the blanks to be
replaced by each correctly guessed letter
word = “hello”
display_word = “”
display_word += "_ "
display_word = display_word.split
guess = “h”
display_word.each_index do |letter, index|
if letter == “_” && word[index] == guess
display_word[index] = guess