Title: Create A Range
Slug: create_a_range
Summary: Create A Range Using Scala.
Date: 2017-01-03 12:00
Category: Scala
Tags: Basics
Authors: Chris Albon
This tutorial was inspired by the awesome Scala Cookbook.
In [17]:
// Create a range between 1 and 10
1 to 10
Out[17]:
In [18]:
// Create an array between 1 and 10 and put in an array
(1 to 10).toArray
Out[18]:
In [19]:
// For each 1 in 1,2,3,4,5
for (i <- 1 to 10)
// Print i
println("index: "+ i)