Example: Writing a Tape Calculator
This chapter has touched upon quite a few different concepts. Presenting a single example that uses all these concepts yet avoids any concepts from future chapters is a practical impossibility. As a result, this example concentrates mainly on illustrating Dim and If statements. Literals, of course, are ubiquitous. Examples in later chapters will duly illustrate arrays and loops.
Figure 3-1 shows the example program running. As you can see, it’s another calculator like the one in Chapter 2. This one, however, has both Add and Subtract buttons, a tape that shows a history of what you entered, and a Clear button. Also, if you try to add or subtract something that isn’t a number, this calculator displays a dialog ...
Get Faster Smarter Beginning Programming 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.