Click here to Skip to main content
15,886,362 members

Survey Results

Do you use block markers (eg. {}, begin/end) when the code block is only a single line?

Survey period: 11 Oct 2021 to 18 Oct 2021

Consistency or compactness? What's your preferred way of marking blocks of code?

OptionVotes% 
I always wrap code blocks in block markers regardless of the number of lines in the block
if (condition) { statement; }
49152.97
I only use block markers when there is more than 1 line
if (condition) statement;
22223.95
The programming language I use requires I always use block markers131.40
I don't program in a language that uses block markers464.96
It depends (on my mood, my team mates, the current project, the language, the phase of the moon...)15516.72



 
GeneralI don't use languages Pin
PIEBALDconsult11-Oct-21 14:35
mvePIEBALDconsult11-Oct-21 14:35 
GeneralRe: I don't use languages Pin
Saša Ćetković12-Oct-21 6:01
professionalSaša Ćetković12-Oct-21 6:01 
GeneralRe: I don't use languages Pin
trønderen15-Oct-21 12:48
trønderen15-Oct-21 12:48 
GeneralVisual Studio 2019 ... Pin
Amarnath S11-Oct-21 14:31
professionalAmarnath S11-Oct-21 14:31 
GeneralRe: Visual Studio 2019 ... Pin
Greg Utas12-Oct-21 2:32
professionalGreg Utas12-Oct-21 2:32 
GeneralRe: Visual Studio 2019 ... Pin
trønderen15-Oct-21 12:50
trønderen15-Oct-21 12:50 
GeneralGenerally yes, but depends too Pin
Erik Burd11-Oct-21 7:55
professionalErik Burd11-Oct-21 7:55 
GeneralRe: Generally yes, but depends too Pin
Matias Lopez12-Oct-21 4:10
Matias Lopez12-Oct-21 4:10 
IMHO, I prefer:

if (!whatever) return 'Something';


But if i need to put more code in a single line:

if (!whatever) {
  return auxObj.toResult( data => {
      // TO-DO!
    } );
}

GeneralI always use block markers. Well ... Pin
OriginalGriff11-Oct-21 6:36
mveOriginalGriff11-Oct-21 6:36 
GeneralRe: I always use block markers. Well ... Pin
Nelek11-Oct-21 8:17
protectorNelek11-Oct-21 8:17 
PraiseRe: I always use block markers. Well ... Pin
den2k8811-Oct-21 20:47
professionalden2k8811-Oct-21 20:47 
GeneralRe: I always use block markers. Well ... Pin
Nagy Vilmos15-Oct-21 1:23
professionalNagy Vilmos15-Oct-21 1:23 
GeneralRe: I always use block markers. Well ... Pin
OriginalGriff15-Oct-21 1:34
mveOriginalGriff15-Oct-21 1:34 
GeneralRe: I always use block markers. Well ... Pin
trønderen15-Oct-21 13:13
trønderen15-Oct-21 13:13 
GeneralRe: I always use block markers. Well ... Pin
trønderen15-Oct-21 13:00
trønderen15-Oct-21 13:00 

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.