4 ms·
I don't know why people are downvoting you for sharing your suggestions. Your syntax suggestion for _OnBreak and _OnComplete does seem better for the following
by webmobdev 4y ago
I don't know why people are downvoting you for sharing your suggestions. Your syntax suggestion for _OnBreak and _OnComplete does seem better for the following reason - 1. Both are related to the for loop, and the usage of :: makes them stand out and seems to gives them more context. 2. Easier and elegant to read. (But is that because the example uses a 1 line code? What would be the best way to present multiline code without confusion?)
(I would have preferred if the _OnBreak and _OnComplete statements was inside the for loop as that removes any ambiguity that it is part of it and effects the for loop).
However, `if v == 11 {break}` is definitely more readable than `break if v == 11`. If you are using curly braces as part of your syntax, and for blocks of code, it's better to use it with consistence. That can be confusing with `break {if v == 11}` as it breaks the syntax grammar, when you consider what break does.
- jbverschoor 4y agoMaybe do some Ruby programming and then reconsider what you think is more readable. the break, food out break out of the if block? Or somewhere else? It’s confusing
- webmobdev 4y agoThat's silly - this isn't Ruby. It's a new language still under development and thus will have its own syntax. Obviously any language will be unreadable if you don't understand its grammar (syntax). Readability is tied to the syntax of a programming language. (And Ruby is great example of this - I am used to Python and I found reading Ruby code to be very cumbersome because of its weird syntax, which I didn't bother to learn). This a C / C++ / D like language.