Last Day Cruzin’

This post is part of a series. You can start with Cruzin’, then Cruzin’:Day Two, Mexican Adventures and Cruzin’ Day IV:Poison & Magic.

Cloudy beach view

See that? That’s the beach at Bimini, part of the Bahamas. See that ship, that’s our ship. See those clouds? Full of rain. Looks like that hurricane is getting closer.

Continue reading “Last Day Cruzin’”

Programming Basics for Duncan IV: Subs and Functions

In programming you’ll find that you want the computer to do the same thing again and again, usually something pretty basic. Early on, programmers decided that they didn’t want to write the same instructions again and again so they developed subroutines and functions.

A subroutine is a snippet of code that you can abstract so it can be used again and again. It can be dead simple like this one that makes the computer beep, twice:

SUB BeepTwice
BEEP
BEEP
END
Continue reading “Programming Basics for Duncan IV: Subs and Functions”

Programming Basics for Duncan part III: If and Loops

Your most basic and common decision-making statement is the if command. It always takes this form:

IF (some test that returns a boolean true/false) THEN (do something)

So you have a test and a something(s) to do if the test resolves to true. This is where we use the comparitors from last chapter:

IF x=5 THEN do something
Continue reading “Programming Basics for Duncan part III: If and Loops”

Programming Basics for Duncan part II: Primitives

It’s fun to call them primitives because it makes you feel smart but what we are talking about are the most basic things in a program.

Values

The most basic thing in a program is a value. It is what it is. It can be a number, 5 if my favourite, a letter like K or k or perhaps a decimal like 0.7. Or maybe a boolean value like 1 or 0. It is only one thing. It is a single answer to a question. It is not a word, those a strings, which are a list of values.

Continue reading “Programming Basics for Duncan part II: Primitives”

Programming Basics for Duncan Part I: Hello World

The classic first program on any platform is to output the string “Hello World”. Hang on, string? Yes, it’s a string of characters: H-e-l-l-o-space-W-o-r-l-d. Technically, it’s an array but you don’t need to know about that now.

Continue reading “Programming Basics for Duncan Part I: Hello World”