[POLL] Do you like "then,do,end" or "{ }"?
Re: [POLL] Do you like "then,do,end" or "{ }"?
The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: [POLL] Do you like "then,do,end" or "{ }"?
uh... there's no reason they can't (lua's parser has no problem doing it). they just don't for some reasonT-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Re: [POLL] Do you like "then,do,end" or "{ }"?
Notpad++ does it for me, I've never had to worry about thatT-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Your screen is very zoomed in...
Re: [POLL] Do you like "then,do,end" or "{ }"?
Really? Notepad++ has never done that for me. Did you use some add-on or something?mickeyjm wrote:Notpad++ does it for me, I've never had to worry about thatT-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: [POLL] Do you like "then,do,end" or "{ }"?
Nope, just set the language to LuaT-Bone wrote:Really? Notepad++ has never done that for me. Did you use some add-on or something?mickeyjm wrote:Notpad++ does it for me, I've never had to worry about thatT-Bone wrote:The only downside I can think of with keywords is that editors can't match them up, which can make some mistakes hard to notice.
Your screen is very zoomed in...
Re: [POLL] Do you like "then,do,end" or "{ }"?
I realize now that it marks blocks on the left with those blue and red lines, which is definitely good enough. What I was talking about was what it does with parentheses, where if you click on one parenthesis it will highlight the matching one. Highlighting an "if" will not highlight the corresponding "end", which is a pity, but not something you can't live without.
My game called Hat Cat and the Obvious Crimes Against the Fundamental Laws of Physics is out now!
Re: [POLL] Do you like "then,do,end" or "{ }"?
Python has always fascinated me with it's syntax, and I generally prefer its methods of code blocking. On-topic though, it has to be brackets. Lua is fantastic in that it's so readable and user-friendly, but the lazy brogrammer in me feels somewhat belittled by having to use "then" and things like lack of "+=". Bartbes wrote a script that almost pre-pre-compiles your files to add "+=" functionality, I suppose in theory you could do the same and more (Moonscript for example, though I'm too lazy to go and see how this was implemented right now).
As hinted at previously, I do feel that "then/do/end" have a rightful place in Lua, because they are appropriate, simple and help with readability.
As hinted at previously, I do feel that "then/do/end" have a rightful place in Lua, because they are appropriate, simple and help with readability.
Do you recognise when the world won't stop for you? Or when the days don't care what you've got to do? When the weight's too tough to lift up, what do you? Don't let them choose for you, that's on you.
Re: [POLL] Do you like "then,do,end" or "{ }"?
I'd probably go with the style guide for Ruby:
Which isn't really more hard to understand than
- do, end for multi-line blocks
- { } for single-line blocks
Code: Select all
(1..10).select {|num| num.even?}
=> [2, 4, 6, 8, 10]
Code: Select all
(1..10).select do |num|
num.even?
end
=> [2, 4, 6, 8, 10]
-
- Prole
- Posts: 30
- Joined: Tue Feb 12, 2013 7:45 pm
Re: [POLL] Do you like "then,do,end" or "{ }"?
I like pythons aproache to this the best though. It's really good for beginners because it forces you to use good coding standards (you would format your code like that anyway, right?) and it's functional by not having to have an extra keyword or {}.
-
- Prole
- Posts: 30
- Joined: Tue Feb 12, 2013 7:45 pm
Re: [POLL] Do you like "then,do,end" or "{ }"?
I agree with everything you saidLafolie wrote:Python has always fascinated me with it's syntax, and I generally prefer its methods of code blocking. On-topic though, it has to be brackets. Lua is fantastic in that it's so readable and user-friendly, but the lazy brogrammer in me feels somewhat belittled by having to use "then" and things like lack of "+=". Bartbes wrote a script that almost pre-pre-compiles your files to add "+=" functionality, I suppose in theory you could do the same and more (Moonscript for example, though I'm too lazy to go and see how this was implemented right now).
As hinted at previously, I do feel that "then/do/end" have a rightful place in Lua, because they are appropriate, simple and help with readability.
Who is online
Users browsing this forum: Semrush [Bot] and 3 guests