Computer Science Canada

What's the difference between = and :=

Author:  Danyn [ Tue Dec 03, 2013 9:47 pm ]
Post subject:  What's the difference between = and :=

Not exactly a question that requires code, just looking for some clarification.

Author:  evildaddy911 [ Tue Dec 03, 2013 9:53 pm ]
Post subject:  RE:What\'s the difference between = and :=

ok, so '=' is used for comparison; its used in 'if' statements; while ':=' is used for assignment, where you assign values to variables.
for example,
Turing:

x := 5
if x = 5 then

however, the turing compiler will accept '=' in place of ':=', meaning that
Turing:

x = 5
% is equivalent to
x := 5


unfortunately, the reverse is not true.
Turing:

if x := 5 then

will not compile

Author:  Raknarg [ Wed Dec 04, 2013 1:55 pm ]
Post subject:  RE:What\'s the difference between = and :=

Don't get this confused with other languages.

Java, C and Python (that I know for sure) use = for assignment, and use == for comparisons.

Author:  mr.frenchman [ Wed Dec 04, 2013 2:34 pm ]
Post subject:  RE:What\'s the difference between = and :=

In pascal and delphi " := "- used for assigning value


: