We write code for computers, using programming languages that are easy to read for us but impossible to understand by a computer. So we translate that code into machine code
and then computers can read it and do something with it. That something is often refered to as executing
or running
the code. But what does that mean?
The code we write is usually just a list of instructions for the computer the carry out. So, if for example we create a program that is supposed to show us a blue triangle on the screen, running
the code will do exactly that: it will try
and show us a blue triangle on the screen.
IMPORTANT
Notice the word try
. As mentioned in the previous post, just because the code compiled
, it doesn't mean the execution
of the program will be successful. We can get execution errors
, which happen while the computer is trying to run our code. These errors are refered to as runtime errors
.
An execution error occurs when a program is asked to do something that it cannot and results in a crash
. The most used example of a run time error is asking a program to divide by 0. The code contains no syntax or logic errors but when it runs it can't perform the task that it has been programmed to carry out - you can read more about this [here](https://www.zmescience.com/science/news-science/divide-zero-mechanical-calculator/#:~:text=Division%20by%20zero%20is%20a,the%20answer%20i
Top comments (0)