Part II: Learning Programming with Liberty BASIC .......59

Chapter 5: Getting Your Hands on a Real Language: Liberty BASIC . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .61 Why Learn Liberty BASIC? ...........................................................................62 Liberty BASIC is (almost) free ...........................................................62 Liberty BASIC is easy ..........................................................................62 Liberty BASIC runs on Windows .......................................................62 You can start using Liberty BASIC today .........................................63 Installing Liberty BASIC ................................................................................63 Loading Liberty BASIC ..................................................................................64 Your First Liberty BASIC Program ...............................................................64 Running a Liberty BASIC program .....................................................65 Saving a Liberty BASIC program ........................................................66 Loading or starting a Liberty BASIC program ..................................67 Using Keystroke Commands in Liberty BASIC ..........................................68 Getting Help Using Liberty BASIC ...............................................................69 Exiting Liberty BASIC ....................................................................................70

Chapter 6: Handling Input and Output . . . . . . . . . . . . . . . . . . . . . . . . . . .71 Inputting and Outputting Data: The Old-Fashioned Way .........................71 Inputting and Outputting Data: The Modern Way .....................................74 Getting input ........................................................................................74 Displaying output ................................................................................75 Sending Data to the Printer ..........................................................................76

Chapter 7: Variables, Constants, and Comments . . . . . . . . . . . . . . . . .79 Storing Data in Variables ..............................................................................80 Creating a variable ..............................................................................81 Assigning a value to a variable ..........................................................83 Declaring your variables ....................................................................87 Using Constants .............................................................................................90 Commenting Your Code ...............................................................................92

Chapter 8: Crunching Numbers and Playing with Strings . . . . . . . . .95 Adding, Subtracting, Dividing, and Multiplying ........................................95 Using variables ....................................................................................96 Working with precedence ...................................................................97 Using parentheses ...............................................................................99 Using Liberty BASIC's Built-In Math Functions .......................................100 Manipulating Strings ...................................................................................101 Declaring variables as strings ..........................................................102 Smashing strings together ...............................................................103 Playing with Liberty BASIC's String Functions ........................................103 Playing with UPPERCASE and lowercase .......................................104 Counting the length of a string ........................................................104 Trimming the front and back of a string .........................................105 Inserting spaces .................................................................................106 Yanking characters out of a string ..................................................106 Looking for a string inside another string ......................................107 Converting strings into numbers (and vice versa) .......................108

computer programming for dummiesWhere stories live. Discover now