Click here to Skip to main content
15,898,134 members

Survey Results

Do you wrap single line statements in braces (or begin/end)?   [Edit]

Survey period: 16 May 2011 to 23 May 2011

Do you:

if (condition)
    statement
or
if (condition)
{
    statement
}
(Replace {}'s with Begin/End or whatever is appropriate for your language du jour)

OptionVotes% 
I always wrap single line statements95548.04
I sometimes wrap single line statements57328.82
I never wrap single line statements - only multiple lines get wrapped.46023.14



 
AnswerI never wrap single line statements - only multiple lines get wrapped. [modified] Pin
Prasad CM23-Jun-11 0:09
Prasad CM23-Jun-11 0:09 
GeneralI answered second Pin
Kevin McFarlane21-May-11 5:56
Kevin McFarlane21-May-11 5:56 
GeneralRe: I answered second Pin
Christian Graus21-May-11 10:22
protectorChristian Graus21-May-11 10:22 
GeneralRe: I answered second Pin
Anand Ranjan Pandey21-May-11 10:37
professionalAnand Ranjan Pandey21-May-11 10:37 
GeneralRe: I answered second Pin
Kiran Sonawane28-Jun-11 20:54
Kiran Sonawane28-Jun-11 20:54 
GeneralWow, Looks like most people do it wrong. Pin
Matt Gerrans20-May-11 19:07
Matt Gerrans20-May-11 19:07 
Having superfluous junk in your code makes it more readable? Nonsense. If that's true, then you should put curlies around every block, not just conditions.

The argument that it "prevents bugs" because people will be fooled by indentation is as lame as it can be. First, you should fire anyone who is that stupid, second you should indent correctly in the first place.

Should we also have semicolons on empty lines so people don't get confused by them and think that maybe there is some WhiteSpace programming going on in them?

This is why Python is such a cool language. The indentation must be correct and you don't have any religious wars over white space (though you do have to deal with goofballs who insist on using tabs instead of spaces, because "it is more efficient" -- of course, these same people are using bloated XML all over the place, but why be rational and consistent when you are talking about premature optimization?).
Matt Gerrans

GeneralRe: Wow, Looks like most people do it wrong. Pin
PIEBALDconsult21-May-11 7:47
mvePIEBALDconsult21-May-11 7:47 
GeneralRe: Wow, Looks like most people do it wrong. Pin
Amar Chaudhary21-May-11 23:19
Amar Chaudhary21-May-11 23:19 
GeneralRe: Wow, Looks like most people do it wrong. Pin
Dávid Kocsis22-May-11 9:04
Dávid Kocsis22-May-11 9:04 
GeneralRe: Wow, Looks like most people do it wrong. Pin
hfrmobile24-May-11 11:49
hfrmobile24-May-11 11:49 
GeneralCode Normalization Pin
Rafael Cabral19-May-11 2:03
Rafael Cabral19-May-11 2:03 
GeneralVB.NET "Single line" is wrapped Pin
Mark Hurd18-May-11 16:34
Mark Hurd18-May-11 16:34 
GeneralFormat Document [modified] PinPopular
Hossein Montazeri18-May-11 4:34
professionalHossein Montazeri18-May-11 4:34 
GeneralRe: Format Document Pin
Ennis Ray Lynch, Jr.19-May-11 5:38
Ennis Ray Lynch, Jr.19-May-11 5:38 
GeneralRe: Format Document Pin
Hossein Montazeri19-May-11 22:00
professionalHossein Montazeri19-May-11 22:00 
GeneralHah. Pin
Pete O'Hanlon18-May-11 3:28
mvePete O'Hanlon18-May-11 3:28 
GeneralI always wrap Pin
Russell Jones18-May-11 2:14
Russell Jones18-May-11 2:14 
GeneralI always Wrap PinPopular
Sunil Gajjar [India]17-May-11 23:04
Sunil Gajjar [India]17-May-11 23:04 
GeneralI always wrap single line statements... PinPopular
Lizandro Campbell17-May-11 9:30
professionalLizandro Campbell17-May-11 9:30 
GeneralAlways... Pin
CodingLover17-May-11 19:40
CodingLover17-May-11 19:40 
GeneralRe: I always wrap single line statements... Pin
RedSonja17-May-11 19:53
RedSonja17-May-11 19:53 
GeneralRe: I always wrap single line statements... Pin
Pong D. Panda20-May-11 19:19
Pong D. Panda20-May-11 19:19 
GeneralRe: I always wrap single line statements... Pin
Kevin McFarlane21-May-11 5:51
Kevin McFarlane21-May-11 5:51 
GeneralI always wrap Pin
Sheo Narayan17-May-11 6:06
Sheo Narayan17-May-11 6:06 
GeneralSchizo? PinPopular
quinton196917-May-11 4:25
quinton196917-May-11 4:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.