Chapter 2.  The Basic Language

In Chapter 1 you wrote a working application with REALbasic, where the user can press a button and, in response, hears a beep and sees a little dialog. Just possibly, however, you’d like your application to do a little more than this when the user presses that button. In that case, you’re going to need to write some code, using REALbasic’s programming language, which (as the name implies) is a form of Basic. In this chapter, you’ll start to learn REALbasic’s Basic; in fact, you’ll learn all there is to know about it, except for the bits having to do with object-orientation. Those bits come in Chapter 3 and Chapter 4.

The name “Basic” is applied to any programming language that descends from the original BASIC (Beginner’s All-purpose Symbolic Instruction Code) invented in 1964 by Thomas Kurtz and the late John Kemeny. College courses about computers were new in those days, and BASIC was one of the first computer languages deliberately designed for teaching nonspecialist beginners to program. It gained popularity, in a somewhat bastardized form, in the mid-1970s when it was built in to early personal computers; these computers had tiny memories, but such wizards as Steve Wozniak and Bill Gates ingeniously constructed even tinier BASIC interpreters for them.

The original BASIC was characterized by a small, simple, English-like vocabulary and syntax, surrendering elegance and even convenience to let the user write acceptable code immediately, ...

Get REALBasic: TDG, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.