Step through a sequence with positions.

Indexed Stepping

IndexedStep.scala
object Main {
  def main(args: Array[String]): Unit = {
    val start = 
    val items = List("a", "b", "c")
    var log = ""
    for ((item, idx) <- items.zipWithIndex) {
      log = log + (idx + start) + ":" + item + " "
    }

    println("log=" + log.trim)
  }
}
object Main {
  def main(args: Array[String]): Unit = {
    val start = 
    val items = List("a", "b", "c")
    var log = ""
    for ((item, idx) <- items.zipWithIndex) {
      log = log + (idx + start) + ":" + item + " "
    }

    println("log=" + log.trim)
  }
}
object Main {
  def main(args: Array[String]): Unit = {
    val start = 
    val items = List("a", "b", "c")
    var log = ""
    for ((item, idx) <- items.zipWithIndex) {
      log = log + (idx + start) + ":" + item + " "
    }

    println("log=" + log.trim)
  }
}
indexed-step `zipWithIndex` pairs each element with its position. Iterating those pairs steps through the sequence while tracking where each element sits.