Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does := mean when used in pseudocode?

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.

like image 772
TheTedinator Avatar asked Nov 20 '11 04:11

TheTedinator


People also ask

What does := mean in algorithm?

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.

What are the syntax of pseudo code?

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.


1 Answers

:= 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.

like image 151
kevinji Avatar answered Nov 10 '22 22:11

kevinji