I was wondering if in swift
there is a way to manipulate the running index on a for loop
.
Using while the program should do the following:
var runIndex = 1
while runIndex <= 100000000 {
print(runIndex)
runIndex = runIndex * 10;
}
In java would look as follows:
for (int runIndex=1; runIndex <= 100000000; runIndex = runIndex*10){
System.out.println(runIndex);
}
I looked at stride
but does not seem to be doing factor, it only does linear
for runIndex in stride(from: 1, to: 100000000, by: 10) {
print(runIndex)
}