/*  Exploring Languages with Interpreters and Functional Programming
    Copyright (C) 2019, H. Conrad Cunningham
    Procedural Counting Program in Scala

1234567890123456789012345678901234567890123456789012345678901234567890

2019-01-24: Adapted from CountingProc.py and CountingImp2.scala

*/

object CountingProc {

    def counter(count: Int, maxc: Int) {
        var kount = count

        def has_more(count: Int, maxc: Int) = // Boolean
            count <= maxc 

        def incr {
            kount = kount + 1
        }

        while (has_more(kount: Int, maxc: Int)) {
            println(kount.toString)
            incr
        }

    }

    def main(args: Array[String]) {
        counter(0,10)  
    }
}


