Why do i have to put the input first when I execute a code on SoloLearn?....when its supposed to go step by step when I call it. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Why do i have to put the input first when I execute a code on SoloLearn?....when its supposed to go step by step when I call it.

Example: import java.util.Scanner; public class Test{ public static void main(String args[]){ Scanner input = new Scanner(System.in); int x; System.out.println("Enter an integer");/*this line it's supposed to be first.*/ int x = input.nextInt(); //but SoloLearn ask me first for the input

8th Aug 2021, 4:57 AM
Cesar
Cesar - avatar
2 Answers
+ 3
That's how code playground on Sololearn works. It takes your code (along with whatever input your code needs from the user), runs it on Sololearn's computers and returns the output to you. I suspect that they do this to manage the average run time of user's codes. Every code has a fixed run time of about 15 seconds (if I remember correctly). Allowing a code to keep running until an input is given may take up too much time. https://www.sololearn.com/discuss/1885390/?ref=app https://www.sololearn.com/discuss/323377/?ref=app https://www.sololearn.com/discuss/1315651/?ref=app
8th Aug 2021, 5:14 AM
David Akhihiero
David Akhihiero - avatar
+ 1
Thanks
8th Aug 2021, 5:16 AM
Cesar
Cesar - avatar