seegongsik
Saved words
seegongsik
Programming · how to tell a computer what to do

Speaking in code

A computer can't act on its own. Write what to do and in what order, and it does just that. Let's learn how to write it, step by step.

16 / 16
01What is code, really?
Words that tell a computer what to do, in order. Like a recipe, line by line, top to bottom.
02Where do we store values?
A box that holds a value with a name on it. Keep the box, change the value, stay flexible.
03How do we exchange values?
Output shows on screen, input takes a value in. The two directions an app talks with us.
04Numbers, text, true and false
A value's kind decides what it can do. The text "3" and the number 3 are different.
05If so, then a fork
Pick a path by whether a condition is true or false. The first moment a program decides on its own.
06Calculating with symbols
Symbols that add, subtract, and compare. They make new values or give true and false.
07Doing the same thing many times
Write the same thing once and have it done many times. What a computer does best.
08A Row of Boxes: Arrays
Line things up in a row and grab any one by its spot.
09Bundle it, give it a name
Bundle several things into one chunk and give it a name. Call the name and it all happens.
10A function that calls itself: recursion
A function calls itself, splitting a big problem into the same smaller one.
11Boxes you find by name: key and value
Pull a value out by name (the key), not a number. Name tags don't repeat.
12Many name tags in one box: objects
Bundle several tag -> value pairs into one box and treat it as one thing. Pull values with box.tag.
13Inheriting what's shared: inheritance
Put several objects' common parts in a 'parent' once; children inherit them and add their own. Fix the parent and all children change together.
14Finding and fixing what's wrong: debugging
An error hints 'where and what' went wrong. Halve to find the cause, change one thing, then re-run to confirm.
15Turning text into machine work: compilers and interpreters
Human-word code can't run as-is. A compiler translates it all ahead of time; an interpreter runs it line by line on the spot. The two are a trade-off.
16Where values live and what names point to: memory and references
A value lives in a memory slot (address); a name points to it. Small values are copied and independent; big things share one slot and change together.
Was this helpful? Support seegongsik