Quantcast
Channel: alvinalexander.com - sequence
Viewing all articles
Browse latest Browse all 25

How to use Scala for loops with multiple counters

$
0
0

This is an excerpt from the Scala Cookbook (partially modified for the internet). This is Recipe 3.2, “How to use Scala for loops with multiple counters.”

Problem

You want to create a loop with multiple counters, such as when iterating over a multi‐dimensional array.

Solution

You can create a for loop with two counters like this:

read more


Viewing all articles
Browse latest Browse all 25

Trending Articles