1
votes

in Fortran there are Named Loops but I have not found this function in Julia. Is there a way to do named loops? So that the compiler checks if the end statement corresponds to the correct loop start? Thx for help

For example:

counting: for i = 1:5  
    println(i)  
end counting
1

1 Answers

3
votes

No, this is not a feature, but, instead, the compiler tracks nested loops to allow nested end statements. In addition, there are break, continue, and and try/catch features of the language to do, generally more easily, what naming loops usually do in Fortran. Leaving out a nested end statement with nested loops will generate a syntax error by the compiler.

https://docs.julialang.org/en/v1/manual/control-flow/index.html#man-loops-1