Files in Ruby | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Files in Ruby

I'm trying to create a simple test which *should* write numbers to a file everytime you run it, and then display those numbers in this format: 1: 3 2: 4 3: 9 If the user ran the program 3 times, then put those numbers in (in the same order), then on the third run, that would be the output. When I run it once, it gets the number and writes it correctly. However, when I run it twice, it only displays the number entered in that run. Help? https://code.sololearn.com/cA8dVkOUqmkm/?ref=app

23rd Jul 2017, 5:07 AM
Chris L.
3 Answers
+ 3
Because you can't store data on Sololearn.
23rd Jul 2017, 6:24 AM
The Coding Sloth
The Coding Sloth - avatar
+ 1
o
23rd Jul 2017, 7:33 AM
The Coding Sloth
The Coding Sloth - avatar
0
Actually, I did't use it on SoloLearn @Sloth. I had the file and save.txt file on my own system and workstation.
23rd Jul 2017, 7:33 AM
Chris L.