0

I am using the readline() function to get input from a user and saving that input into a vector.

your_current_guess=readline(prompt="odds or evens? ")

How would I have a vector that saves each input from the user instead of only the most recent input?

Currently the only way I can think of is saving the input from x into a .txt file and then using the scan function to read from it, but I am certain that there would be a more simple and quick alternative.

Phil
  • 7,287
  • 3
  • 36
  • 66
  • 1
    Are you running this `readline` command in a `for` loop? Maybe you can try `your_current_guess[i] = readline(prompt="odds or evens? ")` – Ronak Shah May 21 '20 at 03:53

1 Answers1

1

You can use select.list. But if you need multiple user inputs, you need to put that in a loop.

select.list(c("odd", "even"), multiple = F )
Shan R
  • 521
  • 4
  • 8