When looking at pseudocode (actually, on the Wikipedia article on A*), i came across the use of := to assign or initialize a variable. What does this mean? Is part of some kind of set notation? If it's something complicated, how would one go about implementing this in C++ or Java? Thanks.
It's rarely used in actual programming languages, but in psuedocode the := operator is the assignment operator - more specifically, it assigns the value of the item to the right of the := symbol to the variable on the left.
Pseudo code: It's simply an implementation of an algorithm in the form of annotations and informative text written in plain English. It has no syntax like any of the programming language and thus can't be compiled or interpreted by the computer.
:=
indicates assignment of a variable. :=
is used when =
is a test for equality (rather than the standard ==
seen in most modern programming languages), not an assignment. In Pascal, for instance, :=
is used for assignment, and =
is used to test for equality. See the "Notation" section of the assignment article for a list of notations for assignment.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With