+ 11

PlayGround - User Input before Output ? 🤤

When we write code with user input, it's nice to prompt some info (e.g. "please enter your name", "enter a number", etc..) 🙈 Some times we need two arguments...🤐 Why Code PlayGround does not show output before asking for input ? 🤔 https://code.sololearn.com/coRmj6QQr3hH/?ref=app

1st Jul 2019, 5:17 PM
🍂B. Eitan 🌵
🍂B. Eitan 🌵 - avatar
7 odpowiedzi
+ 39
This is an old problem. Alas it hasn't been solved yet, Sonic. But the good news is there are ways to overcome it. USERS can provide all the information at once, separate the values with new lines. Obviously they have to know what input type and the number of the values (lines) are expected. YOU should provide simple and CLEAR instructions on how users should input data in the comments of your codes. Also remember the order of values in code. For example: /* This program requires your NAME, your AGE and your favorite MOVIE. 1. When prompted, enter your name on the first line and press return on your keyboard to make a new line. 2. Enter your age on the second line and press return. 3. Enter your favorite movie and press "submit". */ The message above can be displayed in case of wrong user input.
2nd Jul 2019, 1:30 PM
🇺🇦 Drake CDR 🇺🇦
🇺🇦 Drake CDR 🇺🇦 - avatar
+ 8
tejaswi kanneganti 🌿 how can i pass command line arguments (at playground) ?
2nd Jul 2019, 5:23 AM
🍂B. Eitan 🌵
🍂B. Eitan 🌵 - avatar
+ 7
The playground is not interactive. You need to give all inputs before you run the code However it is not impossible just enter a line in the input box and you will see the results https://code.sololearn.com/cY9KBVId9FdG In this code (it is c#, sorry no java) I show how you can make a value input script, to be able to explore coding. Also consider using hard-coded values in the playground.
1st Jul 2019, 9:52 PM
sneeze
sneeze - avatar
+ 6
because the program running in SL server, so we cant interact with it direcly
1st Jul 2019, 5:20 PM
Taste
Taste - avatar
+ 6
Could code playground be improved at all one day to send more than a single request to the server for interactive programs?
2nd Jul 2019, 2:32 AM
Sonic
Sonic - avatar
+ 4
Why can't you try command line arguments
1st Jul 2019, 5:39 PM
tejaswi kanneganti
tejaswi kanneganti - avatar