Sunday, August 20, 2017

For Loop in Scala

A very simple program to demonstrate how to use for loop statement in Scala programming language. The code is very basic and easy to understand.

I hope you will find my work useful and beneficial. If you have some questions about programming, about my work please send mu an email at jakerpomperada@gmail.com and jakerpomperada@yahoo.com. People here in the Philippines can contact me at  my mobile number 09173084360.

Thank you very much and Happy Programming.



Sample Program Output


Program Listing

ForLoop.scala

object ForLoop {

  def main(args: Array[String]) {
    var x = 0;


    print("\n\n");
    print("For Loop in Scala");
    print("\n\n");

    for (x <- 1 to 15) {
      println("Value of x is " + x);
    }
  }
}


No comments:

Post a Comment