Giving your program input

The Input tab holds everything your program will read, handed over before it starts. Why nothing pauses to ask you, and what that changes.

View as .md

If your program reads input, put it in the Input tab before you run.

There is no keyboard on the other side#

Your code runs in a sandbox with no terminal attached. Whatever is in the Input box is handed to the program as standard input, exactly as if you had piped a file into it on your own machine.

Two consequences follow, and between them they explain almost every surprise:

  1. All of it arrives before your first line runs. The box is not a keyboard buffer being typed into as you go. Every read takes the next piece of something already there.
  2. Prompts print, they do not wait. print("Enter your name: ") still prints - it just does not stop anything. Two prompts in a row land on the same line, because nothing happened in between.

If you ask for more than you gave#

There is no prompt to fall back on. If your code reads four values and the box holds three, the fourth read has nothing to take, and what happens then is your language's normal end-of-input behaviour - an exception in Java, an empty string in Python, and so on.

SQL is different#

A SQL project has no separate input in this sense - the runner feeds your query in. There is nothing to put in the box.

Was this page helpful?

Last checked against the product on . Behaviour changes are listed in the changelog.