For loop issue

This loop in Silver.NET:

for i in (0..<3) {
}

loops from 0 to 3, but should go from 0 to 2. Right?

This one:

for i in (0..2) {
}

will go from 0 to 1.

Doesn’t make sense, should be vice versa.

Using VS2015 with the latest Elements 9.3 stable release.

thanks! fixed

Actually; I fixed this but my fix was completely wrong. The output seems fine?

import System.Collections.Generic
import System.Linq
import System.Text
import System.Threading.Tasks

print("The magic happens here.")

for i in (0..<3) {
    writeLn(i);
}

for i in (0...2) {
    writeLn(i);
}

print("")

The magic happens here.
0
1
2
0
1
2

hmm I get

~> Process ConsoleApplication221 started.
The magic happens here.
loop a: 0
loop a: 1
loop a: 2
loop a: 3
loop b: 0
loop b: 1


~> Process ConsoleApplication221 terminated with exit code 0

for

import System.Collections.Generic
import System.Linq
import System.Text

print("The magic happens here.")

for i in (0..<3) {
	writeLn("loop a: "+i);
}

for i in (0...2) {
	writeLn("loop b: "+i);
}

so it does indeed seem broken.

(note to OP, .. isn’t valid, only ... is?)

Thanks, logged as bugs://79436

bugs://79436 got closed with status fixed.

Turns out the problem was with the Range type. for I in 0...2 would use an optimized for/to loop, and work, for I in (0...2) with parenthesis used the Range type, which was broken. Fixed for today’s upcoming beta in SBL. Workaround is to nit use parenthesis, or to grab latest SBL form GitHub.