32 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

2021-07-31 17:10:28 +04:00
The first thing that stands between you and writing your first, real,
piece of code, is learning the skill of breaking problems down into
acheivable little actions that a computer can do for you. Of course,
you and the computer will also need to be speaking a common language,
but we'll get to that topic in just a bit.
Now breaking problems down into a number of steps may sound a new
skill, but its actually something you do every day. Lets look at an
example, a simple one: say you wanted to break the activity of fishing
down into a simple set of instructions that you could hand to a robot,
who would do your fishing for you. Heres our first attempt to do that,
check it out:
You can think of these statements as a nice recipe for fishing. Like any
recipe, this one provides a set of steps, that when followed in order,
will produce some result or outcome in our case, hopefully, catching
some fish.
Notice that most steps consists of simple instruction, like "cast line
into pond", or "pull in the fish." But also notice that other
instructions are a bit different because they depend on a condition,
like “is the bobber above or below water?". Instructions might also
direct the flow of the recipe, like "if you havent finished fishing,
then cycle back to the beginning and put another worm on the hook."
Or, how about a condition for stopping, as in “if youre done” then go
home.
Youre going to find these simple statements or instructions are the
first key to coding, in fact every App or software program youve ever
used has been nothing more than a (sometimes large) set of simple
instructions to the computer that tell it what to do.