SECJ1013-02 Programming Technique I

Pre and Post Test

Introduction

For pre test, it requires the keyword while

  • Initialize counter = 0
  • Test counter value: counter > 0
  • Update counter value: counter + 1
  • Use while

For post test, it requires the keyword repeat … until

  • Initialize counter = 0
  • Update counter value: counter + 1
  • Test counter value: counter > 0
  • Use do … while

Pre and Post Test Flowchart