0

gets doesn't reset in dcoder app

when I run gets and then puts in dcoder it asks me for user input the first time I run the code and then outputs the inputted data as a string. but then when I run the same code a second time it doesn't ask for the user input again. it just bypasses that bit of the code and runs the puts... outputting the user input data that i entered the first time I ran the code. shouldn't it reset this string and ask for new user input when it runs gets the second time? this is my code: - x = gets puts x thanks

15th Feb 2020, 7:53 PM
Liam O'Rourke
Liam O'Rourke - avatar
7 Antworten
+ 4
Without having your complete code from Playground linked here, it's not possible to hunt bugs.
15th Feb 2020, 8:40 PM
Lothar
Lothar - avatar
0
that is the complete code. it works fine in sololearn but not in dcoder
15th Feb 2020, 8:42 PM
Liam O'Rourke
Liam O'Rourke - avatar
0
so if I run: - x=gets that will ask me for a user input right... and then: - puts x will output that user input it works fine the first time I do it... but then the second time it doesn't ask me for the user input again. it just takes the string from the first time I entered it
15th Feb 2020, 8:45 PM
Liam O'Rourke
Liam O'Rourke - avatar
0
but what's weird is that if I run the exact same code in the 'try it yourself' console on sololearn... it works fine. it asks me for the input every time
15th Feb 2020, 8:47 PM
Liam O'Rourke
Liam O'Rourke - avatar
0
I mean the second run of the program. there is only one gets in the program. I run it once... and it asks me for user input (like it should). Then it outputs the user input data in puts (like it should). and that's the end of the program. lovely jubbly :) But then when I run it the second time... it doesn't call to gets. It just bypasses gets and outputs the same user data I entered the first time I ran the program. May I add however, that this is only the case when I'm using dcoder as my ide. if I run this code in the built in 'try it yourself' compiler in sololearn it works fine. it calls to gets every time I run the program. so perhaps it's a problem with dcoder. thanks guys
16th Feb 2020, 7:38 AM
Liam O'Rourke
Liam O'Rourke - avatar