There are multiple ways of doing it:
var i = 0
for(x <- xs;y <- ys) {
foo(x,y,i)
i = (i+10)
}
To do it functionally without using external i
:
xs.foldLeft(0){(a:Int,b) =>
ys.foldLeft(a){(c:Int, p) =>
foo(b,p,a)
c+10
}
}