I have a class, in which there’s a method, and that contains a do-end block of code and in that there’s an if-else-end. There are a bunch of ‘end’ keywords near the end of the file. The compiler isn’t happy. Is there one too many? Oh yeah, I’m in ’ module MyStuff’ and forgot. No, compiler still not happy…
What I’d like to do is write ‘end if’ or ‘endif’ instead of just ‘end’ for the one I believe is ending an ‘if’ statement. Likewise, ‘end class’ or ‘and_thats_all_there_is_to_this_class’ or some such. ‘end module’. I sometimes put comments, as in ‘end # class’ for my future reference, but the compiler isn’t going to make any use of that.
If such a feature exists,
great!
end if
Otherwise, are there any tricks in Crystal for making sure one’s ‘end’ statements are in proper shape?
That’s one way to solve the problem. I’ve done that before in various languages. For the present problem in Crystal, I’ve discovered that it’s “while a<b” not “while a<b do”. I bounce between several languages all the time, forgetting the syntax details.