Here is a short list of SOME of the tasks we can carry out with code:
Interact with users. Through code, we can ask a user questions, store the
answers, and respond by changing what is on the screen.
Interact with other systems. Through code, we can interact with resources
that are outside of our program. For example, we can read data in from a
file on our computer, or we can ask a server on the other side of the planet
Repeat tedious tasks. Have a few thousand emails to send? Need to spellcheck
several thousand words? You can do these things with just a handful of code.
Reuse useful code snippets. Rather than copy/paste the same lines of code in
multiple places, we can assign a name to that code. This allows us to use it
wherever we like by simply referring to its name.
Decide what to do based on the current situation. When we write code, we
often need to carry out one task under a specific set of circumstances,
but another task if the circumstances differ. We can write code to decide
which action to take.
Of course, in order to work, code needs to follow a specific set of rules.