C and Java have the best variable declaration syntax, so lets follow suit with that, minus the semi-colon of course
Int x = 5
Pascal's
x: Integer
doesnt leave room for initializing it with a value, and besides, ":" is already being used to mean "new line"
BASIC's
Dim x as Integer
is way overkill, it would have been better if you could have said
Dim x as Integer = 5 - but no, they wanted to be difficult.
C says it perfectly.
Of course, we need to allow people to declare 2 Ints on one line
Int x = 5, y = 7
and Of course, we need to allow people to choose not to set an initial value, so this would be fine.
Int x, y
But, unlike C, an uninitialized variable takes on the default value for the data type - like 0, or empty string, or whatever is defined by the type definition.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
C and Java have the best variable declaration syntax, so lets follow suit with that, minus the semi-colon of course
Int x = 5
Pascal's
x: Integer
doesnt leave room for initializing it with a value, and besides, ":" is already being used to mean "new line"
BASIC's
Dim x as Integer
is way overkill, it would have been better if you could have said
Dim x as Integer = 5 - but no, they wanted to be difficult.
C says it perfectly.
Of course, we need to allow people to declare 2 Ints on one line
Int x = 5, y = 7
and Of course, we need to allow people to choose not to set an initial value, so this would be fine.
Int x, y
But, unlike C, an uninitialized variable takes on the default value for the data type - like 0, or empty string, or whatever is defined by the type definition.