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

1234567890123456789012345678901234567890123456789012345678901234567890

2019-01-24: Adapted from Counting.hs and CountingImp2.scala
2022-03-10: Fixed proc syntax deprecation

*/

object CountingFun {

    def counter(count: Int, maxc: Int): String =
        if (count <= maxc)
            count.toString ++ "\n" ++ counter(count+1,maxc)
        else
            ""
    def main(args: Array[String]): Unit = {
        println(counter(0,10))
    }

}
