Error in using range() in for loop
mehanalavimajd opened this issue · comments
Hascal version:
Hascal 1.3.12 --- linux
OS:
Linux ubuntu 20.04
What did you do?
I found this in docs, And I ran that:
function main() : int {
for i in range(0, 10) {
print(i)
}
return 0
}
What did you expect to see?
Printing 0 to 9
What did you see instead?
Error : Syntax error at line 2, token=LPAREN, value=(
Error : Unknown error in compile file
Also the problem is not from for loop cause It can run this:
function main() : int {
var foo : [int] = [1,2,3]
for i in foo {
print(i)
}
return 0
}
It runs successfully.
Oops! This is a mistake created with GitHub Copilot when i wrote docs.
Use this :
function main() : int {
var foo : [int] = [1,2,3]
for i in foo {
print(i)
}
return 0
}
I will fix this mistake.
Ok, what about 100 time doing something with for loop?
It is important to add a range function in hascal.
Added to our todo list, thank you for your contribution.