-- ==================================================================================
--  WHAT looping_hello DOES
--
--  Very basic work with loops, and printing information to the terminal. 
--  look at concurrent_hello programs for more interesting things :D
-- ==================================================================================


--{{{ this module contains utilities for pringin useful types (like strings)
--    (like strings) to a chanel (which can be linked to the terminal screen)
#INCLUDE "course.module" 
--}}} 
        

PROC outer(CHAN BYTE in?, out!, err!) -- outter most procedure with the parameters appropriate for kroc to to link to unix system
  VAL INT start.counter IS 3:         -- defining a constant of type int, and assigning it a value
  INT counter:                        -- defining a variable 'counter' of type int
  SEQ                                 -- the following is executed in sequential order
    out.string("*nThis educational program prints some text...*n*n", 0, out!)
    counter := start.counter          -- assign intitial value to variable (from contstant)
    WHILE counter > 0
      SEQ
        out.int(counter, 0, out!)     -- output the value of counter
        out.string("*n", 0, out!)     -- create a newline
        counter := counter - 1        -- decrement counter
    out.string("*nThis educational program ends now...*n*n", 0, out!)     -- nice message as output to terminate
:
