Programming 3 Program Branching and Looping ContentObjective Learn
Programming 3 Program Branching and Looping Content-Objective: Learn BASIC programming branching and looping skills. Language-Objective: Create a BASIC program utilizing branching and looping using JUST BASIC.
Programming 3 Program Branching and Looping Utah State Robotics 1 Standard 3 Common Core High School Algebra Reasoning Common Core High School Interpreting Functions
Do today’s Starter Quiz! (in Canvas)
Starter Information DEFINITION Program Loop A set of computer instructions that is repeatedly executed in a never ending “looping” sequence
Starter Information DEFINITION Branching A computer instruction that redirects program execution to an instruction that is not the next listed instruction in the program structure listing
BASIC LOOPING COMMANDS 1. WHILE (While a condition exists the program executes the program instructions between the WHILE and WHILE-END (WEND) repeatedly) 2. IF, THEN, ELSE (program logic argument where program execution is determined by the logic state of an object)
BASIC BRANCHING COMMAND 1. GOTO (reroutes program execution to address listed after GOTO instruction)
END STARTER INFORMATION
Today's Class Task Create a simple BASIC program from a flowchart using Just Basic v 1. 01
Just BASIC SCREEN
Just BASIC Information 1. Click on “File” then “new BASIC source file” to start entering program. 2. The white area of the screen below the menu bar is where you write your program. 3. All program commands must have a line number before them and numerically they must be in ascending (progressively higher) order as the program goes down the page.
EXAMPLE BASIC PROGRAM 10 CLS 20 X=0 30 WHILE X = 0 40 PRINT “Input your name “ 50 INPUT Y$ 60 IF Y$ = “” THEN 70 GOTO 20 80 ELSE 90 PRINT “My name is “; Y$ 100 END IF 110 X = X + 1 120 WEND 130 END
Program Execution Click on the “RUN” command on the top line of Just BASIC window
- Slides: 13