|
|
|
|
|
by Nvorzula
3143 days ago
|
|
x := some_code_here says "x is a NEW variable whose type is whatever the result of the expression on the right hand side is". Say we have a function, GetInt64(), which...returns an int64. x := GetInt64() both declares x to be an int64 and places the resulting value of the right hand side into x. If x was already to declared to be an int64, E.G.: var x int64 x := GetInt64() Then the compiler complain that x is not new - it has already been declared. In this case you have to omit the colon to remove the fancy "auto" semantics. var x int64 x = GetInt64() |
|
x = 5 <-- a boolean statement, true if x equ 5
x := 5 <-- an assignment of the value 5 to the var x.
TBH, it's only like '=' vs '==' in C like languages. But it's easier to spot errors, as Pascal can never have a valid statement where the two are used in the wrong way.