Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge: Fill an Array | Arrays
Introduction to Scala
course content

Contenido del Curso

Introduction to Scala

Introduction to Scala

1. Getting Started
2. Variables and Data Types
3. Conditional Statements and Loops
4. Arrays
5. Strings

Challenge: Fill an Array

Task

Your task is to create an array of integers of size 20 named testArray and fill it with numbers from 1 to 20 inclusive using a for loop with the loop variable named i to iterate over its indices in a concise way.

java

Main

copy
12345678
object Main { def main(args: Array[String]): Unit = { var ___ = new ___[___](___) // Declare an array variable for (___ ___ testArray.___) { ___(___) = ___ // Fill the array } } }

¿Todo estuvo claro?

Sección 4. Capítulo 3
We're sorry to hear that something went wrong. What happened?
some-alt