Click here to Skip to main content
15,884,472 members

Survey Results

Random style question: Which variable declaration do you prefer?

Survey period: 22 Jul 2019 to 29 Jul 2019

Strict formalism or fast and loose? Typesafe or no type at all? For anyone who switches languages often this can get messy.

OptionVotes% 
int count (Standard C-style)76666.78
count: Integer (eg Pascal)342.96
var count: int, or val count: Integer (eg TypeScript)201.74
var count int (eg Go)191.66
Declare @count int (eg SQL)161.39
Dim Count As Integer (eg VB)786.80
Count = 1 or $count = 1 (eg Python or PHP)282.44
(defvar count 1) (eg LISP, and similar in Scheme)20.17
Other272.35
I'm not fussed. Whatever works.15713.69



 
GeneralC# (and C style?) Pin
Slacker00721-Jul-19 23:47
professionalSlacker00721-Jul-19 23:47 
GeneralRe: C# (and C style?) Pin
honey the codewitch22-Jul-19 2:34
mvahoney the codewitch22-Jul-19 2:34 
GeneralRe: C# (and C style?) Pin
Slacker00722-Jul-19 3:05
professionalSlacker00722-Jul-19 3:05 
GeneralRe: C# (and C style?) Pin
honey the codewitch22-Jul-19 5:46
mvahoney the codewitch22-Jul-19 5:46 
GeneralRe: C# (and C style?) Pin
RandMan755723-Jul-19 2:51
RandMan755723-Jul-19 2:51 
GeneralC# Pin
Akhil Mittal21-Jul-19 23:27
professionalAkhil Mittal21-Jul-19 23:27 
GeneralRe: C# Pin
Slacker00721-Jul-19 23:45
professionalSlacker00721-Jul-19 23:45 
Generalshort, neat unambiguous - C Pin
Eek Ten Bears21-Jul-19 22:34
Eek Ten Bears21-Jul-19 22:34 
C is good for variable declarations because its short, its neat, and its unambiguous.

There is something to be said for more wordy declarations, it makes them easier to spot, but if your code is well commented, you don't produce overlong segments of spaghetti, and you use good variable names then that's hardly an advantage. Also I do a lot of SQL - I hate DECLARE, I hate the way you can DECLARE multiple variables after a DECLARE statement, it ruins my indentation and I have to spend ages fixing it Mad | :mad:

Extra and pointless syntax? Confused | :confused:

Meantime Python: I like the concept of Python, I agree it works well, and I like the idea of a strongly typed, dynamic language; but I hate the way its done, I just think its clunky, its like its been written by lots of different people, all with different opinions, and some of whom were a lot less clever than the others.

{whispers off-screen}

Apparently Python was written by lots of different people, all with different opinions, and some of whom were less clever than the others.
GeneralGods be blessed Pin
den2k8821-Jul-19 21:32
professionalden2k8821-Jul-19 21:32 
Generalpublic int Count {get; private set;} Pin
OriginalGriff21-Jul-19 20:22
mveOriginalGriff21-Jul-19 20:22 
GeneralWell c-style wins because c# is #1 Pin
Mike (Prof. Chuck)21-Jul-19 19:55
professionalMike (Prof. Chuck)21-Jul-19 19:55 
GeneralRe: Well c-style wins because c# is #1 Pin
OriginalGriff21-Jul-19 20:23
mveOriginalGriff21-Jul-19 20:23 
GeneralRe: Well c-style wins because c# is #1 Pin
  Forogar  22-Jul-19 3:09
professional  Forogar  22-Jul-19 3:09 
GeneralRe: Well c-style wins because c# is #1 Pin
Mike (Prof. Chuck)22-Jul-19 3:14
professionalMike (Prof. Chuck)22-Jul-19 3:14 
GeneralRe: Well c-style wins because c# is #1 Pin
OriginalGriff22-Jul-19 3:27
mveOriginalGriff22-Jul-19 3:27 
GeneralRe: Well c-style wins because c# is #1 Pin
  Forogar  22-Jul-19 3:40
professional  Forogar  22-Jul-19 3:40 

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.