You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
End for loops with END and avoid escaping keywords inside loops #3009
At the moment for loops require using \ before keywords inside the loop:
FOR ${var} IN 1 2 3
\ Keyword ${var}
\ Another keyword
Keyword outside loop
This is pretty awkward and not something we want to use if/when we add more control structures or especially if/when we add nested control structures. We were thinking alternatives already in #2783 and considered using | instead of \ (not that much better), Python style indentation using whitespace (likely lot of backwards-compatibility problems) and using explicit END at the end like in Ruby. That issue also proposed changing old :FOR (case-insensitive) to FOR (case-sensitive) and that has been already covered by #2990.
We've now made a decision to go with the END at then end. It makes for loop syntax quite a bit nicer:
FOR ${var} IN 1 2 3
Keyword ${var}
Another keyword
END
Keyword outside loop
This syntax will be supported already in RF 3.1 and the old syntax also works without any deprecation at that point. The old syntax will, however, be deprecated in RF 3.2 to allow adding more/nested control structures hopefully already in RF 3.3.
Notice that when \ can be omitted, the indentation inside loops will be ignored similarly as in most programming languages (Python obviously being an exception). In other words, also the following will work (but won't be recommended):
FOR ${var} IN 1 2 3
Keyword ${var}
Another keyword
END
changed the title [-]Support ending for loops with optional `END`[/-][+]Support ending for loops with `END` and omitting escaping with `\`[/+]on Nov 21, 2018
Initially this issue was only about adding optional END at the end of for loops so that we could later require it and allow omitting \ used for indenting keywords inside loops. It turned out that allowing \ to be omitted is pretty easy as well, so this issue is now changed to cover both. Need to update the description accordingly as well.
changed the title [-]Support ending for loops with `END` and omitting escaping with `\`[/-][+]End for loops with `END` and avoid escaping keywords inside loops[/+]on Nov 24, 2018
Activity
pekkaklarck commentedon Nov 21, 2018
Notice that when
\can be omitted, the indentation inside loops will be ignored similarly as in most programming languages (Python obviously being an exception). In other words, also the following will work (but won't be recommended):[-]Support ending for loops with optional `END`[/-][+]Support ending for loops with `END` and omitting escaping with `\`[/+]pekkaklarck commentedon Nov 21, 2018
Initially this issue was only about adding optional
ENDat the end of for loops so that we could later require it and allow omitting\used for indenting keywords inside loops. It turned out that allowing\to be omitted is pretty easy as well, so this issue is now changed to cover both. Need to update the description accordingly as well.[-]Support ending for loops with `END` and omitting escaping with `\`[/-][+]End for loops with `END` and avoid escaping keywords inside loops[/+]