Structured Programming with Classic BASIC

PseudocodeBASIC
1. Selection (single branch)
if condition
   block
end if
      
      IF NOT (condition) THEN l1:
      block
  l1: REM END IF
      
2. Selection (two branches)
if condition
   block-a
else
   block-b
end if
      
      IF NOT (condition) THEN l1:
      block-a
      GOTO l2:
  l1: REM ELSE
      block-b
  l2: REM END IF
      
3. Selection (three or more branches)
if condition-a
   block-a
else if condition-b
   block-b
else
   block-c
end if
      
      IF NOT (condition-a) THEN l1:
      block-a
      GOTO l3:
  l1: IF NOT (condition-b) THEN l2:
      block-b
      GOTO l3:
  l2: REM ELSE
      block-c
  l3: REM END IF
      
4. Iteration (test before entry (while ...))
while condition
   block
end while
      
  l1: IF NOT (condition) THEN l2:
      block
      GOTO l1:
  l2: REM END WHILE
      
5. Iteration (test before exit (... until))
begin until
   block
until condition
      
  l1: REM BEGIN UNTIL
      block
      IF NOT (condition) THEN l1:
      
6. Iteration (test in middle of processing)
begin loop
   pre-test-block
   if condition then leave
   post-test-block
end loop
      
  l1: REM BEGIN LOOP
      pre-test-block
      IF condition THEN l2:
      post-test-block
      GOTO l1:
  l2: REM END LOOP
      

Valid CSS! Valid HTML 4.01 Strict Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.