John G. Kemeny Thomas E. Kurtz Bronze EDITION GUIDE for Windows and Macos BRONZE Edition Reference Manual
Total Page:16
File Type:pdf, Size:1020Kb
The Original from the Inventors of BASIC John G. Kemeny Thomas E. Kurtz bronze EDITION GUIDE for Windows and MacOS BRONZE Edition Reference Manual bronze Edition Guide for the True BASIC Language System Copyright © 2002 by True BASIC Incorporated ISBN: 0-939553-39-2 All rights reserved. No part of this manual may be reproduced by any means, electronic, mechanical, or photocopying, without the prior written permission of True BASIC, Inc. Address any request for reprinting portions of any material contained in this documentation, listing the purpose of the reprint or citation, and the expected edition size of the publication to True BASIC as the address listed below. Trademarks and their owners: True BASIC: True BASIC, Inc.; IBM: International Business Machines; Apple Macintosh, MacOS: Apple Computer; MS-DOS, Windows, Windows95, Windows98: Microsoft. Published by: True BASIC, Inc. 1523 Maple Street Hartford, VT 05047-0501 USA MANUAL NUMBER: 7222/M 1-800 436-2111 US & Canada Sales Department 1-802 296-2711 International Orders 1-802 296-2715 Fax (24-hour availability) [email protected] Customer Support http://www.truebasic.com Website. Printed in the United States of America. 01/2002 3 Contents 1. An Introduction to Programming .................................................................. 9 2. Why True BASIC? .............................................................................................. 11 3. Installing True BASIC and Running Demo Programs .............................. 13 Installing the BRONZE Edition on Windows .................................................. 13 Installing the BRONZE Editon on the MacOS ............................................... 17 Using True BASIC BRONZE Edition............................................................... 18 Menu Access....................................................................................................... 19 Running a Demonstration Program ................................................................. 20 4. Writing and Running Your First Program................................................... 23 Creating a Program ........................................................................................... 23 The LET Statement ........................................................................................... 25 The PRINT Statement....................................................................................... 26 The END Statement .......................................................................................... 26 How True BASIC Runs a Program ................................................................... 26 Saving Your Program ........................................................................................ 26 5. Modifying and Saving Programs.................................................................... 27 Using Source and Output Windows.................................................................. 27 Making Simple Changes ................................................................................... 28 Adding Comments to Your Program................................................................. 28 Saving Your Changes ........................................................................................ 29 The INPUT Statement ...................................................................................... 29 Saving Your Program With A Different Name ................................................ 31 Opening or Quitting without Saving ................................................................ 31 6. Constants, Variables, and Expressions......................................................... 33 Constants ........................................................................................................... 33 Variables ............................................................................................................ 34 Expressions and Formulas................................................................................ 35 Changing Values of Variables........................................................................... 37 An Introduction to Strings ................................................................................ 38 Using String Constants and Variables............................................................. 39 A Brief Look at String Expressions .................................................................. 40 4 BRONZE Edition Reference Manual 7. More on INPUT and OUTPUT......................................................................... 41 Printing Zones and the PRINT Statement....................................................... 41 More about Controlling Output ........................................................................ 43 More about the INPUT Statement ................................................................... 43 The LINE INPUT Statement............................................................................ 44 The TD_LineInput Subroutine ......................................................................... 45 8. Loop Structures.................................................................................................. 47 How a FOR-NEXT Loop Works ........................................................................ 47 Step Size in a Loop ............................................................................................ 48 Nested Loops...................................................................................................... 50 An Introduction to Conditions .......................................................................... 52 An Introduction to DO Loops and Counters..................................................... 53 Variations on DO Loops, and Combining Conditions ...................................... 55 9. Decision Structures........................................................................................... 57 Simple IF-THEN Decisions............................................................................... 58 Single-line IF-THEN-ELSE Decisions ............................................................. 58 Multiple-line Decisions...................................................................................... 58 More About Counters ........................................................................................ 60 The RANDOMIZE Statement ........................................................................... 61 The STOP Statement......................................................................................... 61 Generating Random Whole Numbers............................................................... 62 Other Decision Structures................................................................................. 63 10. Formatting and Printing Your Program ...................................................... 65 Guidelines for Good Programming ................................................................... 65 Indenting with DO Format ............................................................................... 66 Indenting Blocks with > and <.......................................................................... 67 Listing Your Programs on a Printer ................................................................. 68 Listing Output from your Programs................................................................. 68 Using Line Numbers ......................................................................................... 69 Using the Command Window ........................................................................... 69 11. Editing Hints and Shortcuts............................................................................ 71 Undoing.............................................................................................................. 71 Selecting, Deleting, Moving, and Copying........................................................ 77 Find and Change ............................................................................................... 73 Keep and Include ............................................................................................... 75 Select All and Move To... ................................................................................. 76 Contents 5 12. Using and Storing Data ................................................................................... 77 The DATA and READ Statements.................................................................... 77 Checking for More Data .................................................................................... 79 Reusing Data Values ......................................................................................... 81 Storing Data in Files ......................................................................................... 82 Reading Data from Text Files........................................................................... 83 Creating Text Files............................................................................................ 85 Printing String Data to Text Files.................................................................... 86 Reusing Stored Data for Input.......................................................................... 88 Printing Numeric Data to Text Files................................................................ 89 More about File Input and Output ................................................................... 91 13. Arrays and