3 ms·
Another inreresting example is Lua. It's a free form language without semicolons. It's not indentation sensitive.
by ufo 6y ago
Another inreresting example is Lua. It's a free form language without semicolons. It's not indentation sensitive.
- samatman 6y agoLua does have semicolons! It even has semicolon insertion, but because the language is carefully designed, this doesn't cause problems, and most users can go a lifetime without knowing about it. Our coding style requires semicolons for uninitialized variables, so you'll see local x; if flag then x = 12 else x = 24 end As a way of marking that the lack of initialization is deliberate. `local x = nil` is used only if x might remain nil.
- ufo 6y agoI don't like saying that it's semicolon insertion because it might give people the idea that the semicolons work similarly to Javascript. In Lua, inserting a semicolon is always optional and it's an stylistic matter (like in your example). It even allows putting multiple statements on the same line without a semicolon. -- Two assignment statements x = 10 y = 20