First day and first attempt at using Scala - so go easy on me! I\'m trying to rewrite some old Java code I have which is simply a function which takes two numbers and prints
This way you can use Decreasing for loop in Scala.
object Example extends App {
for(i <- 20 to 2 by -2){
println("Value of i = "+ i)
}
}
------------------
O/P
------------------
Value of i = 20
Value of i = 18
Value of i = 16
Value of i = 14
Value of i = 12
Value of i = 10
Value of i = 8
Value of i = 6
Value of i = 4
Value of i = 2