Running a program means telling the computer to execute the instructions in your code, one by one, from start to finish.
What Happens When You Run a Program#
When you run a program, the computer reads your source code and starts executing it from the beginning. Each instruction is carried out in order. If the program asks for input, execution pauses until the user responds. If the program produces output, it appears immediately. When the last instruction is done, the program exits.
Think of it like reading a recipe aloud to a chef — each step is read and acted on in sequence. The chef doesn’t skip ahead or work backwards.
How Programs Are Run#
The exact command depends on your language and tooling, but the idea is the same: you invoke a tool that takes your code and runs it.
In all cases, the program starts, does its work, and then stops. If something goes wrong — a crash, an error, invalid input — the program exits early and usually prints a message explaining what happened.
For language and tool-specific instructions, see:
Running vs. Building#
Some languages require a build step before running — the source code is compiled into an executable first. Others run the code directly without a separate build step.
Either way, the experience for the programmer is similar: you trigger the run, watch the output, and check the result.
Common Mistakes#
Running the program from the wrong folder
Most tools expect to be run from inside the project folder. If you run the command from a parent or unrelated folder, the tool won’t find your project and will report an error. Always check that your terminal is in the right directory before running.
Editing the file but forgetting to save before running
Changes you make in your editor don’t take effect until the file is saved. If you run the program and don’t see your latest changes reflected, save the file and run again.
Confusing the editor’s run button with the terminal command
Some editors have a built-in run button. This can behave differently from running via the terminal — it may use different settings or run from a different working directory. If results are unexpected, try running from the terminal directly.