Scientists Say: Code

Code is what allows people to tell computers what to do

a teen boy and teen girl look at computer code written on a desktop screen

People tell computers what to do by writing code. That code can tell a computer how to format an image, open an email, run a complex simulation or do many, many other types of tasks.

Maskot/Getty Images

Code (noun, verb, “KOHD”)

In computing, “code” can be a noun or a verb. The noun “code” refers to a set of instructions that tells a computer what to do and how to do it. The verb “code” means to write those commands in a language that a computer can understand. Such sets of instructions are also known as algorithms. Computer algorithms are written in code.

All computers, from smartphones to supercomputers, run on code. Writing code allows someone to make a computer do something. Display an image, for example. Or pull a search result from a database. Or change the font in a document, load a webpage or open an email. Computers can only do what they are coded to do.

Lines of code are written in programming languages. There are many of these languages. But a few of the most popular ones are Java, C++, Python and HTML. People write code in different languages for different tasks. HTML, for instance, is often used to format text and images on websites. But ultimately, code written in any language is translated inside a computer into 0s and 1s. These are the most basic bits of information that computers use to follow instructions.

Computers follow instructions exactly. So, code must be very precise, without errors, for the computer to do what it’s supposed to. Writing code also requires creativity, to figure out what instructions will make a computer do something as efficiently as possible. Computers are only as smart as the code that tells them what to do.

In a sentence

A type of computing called machine learning involves coding computers to learn from examples or experience.

Check out the full list of Scientists Say.

Maria Temming is the Assistant Managing Editor at Science News Explores. She has bachelor's degrees in physics and English, and a master's in science writing.