Really basic syntax question in pseudocode. What does :=
mean in Pseudocode?
Example
a := 1
Really basic syntax question in pseudocode. What does :=
mean in Pseudocode?
Example
a := 1
Pseudocode examples on Wikipedia usually use :=
as the assignment operator, like Pascal does (I haven't found any counterexamples yet).
You can't use it in Python directly as it would be a SyntaxError
:
>>> a := 1
File "<stdin>", line 1
a := 1
^
SyntaxError: invalid syntax
Use
a = 1
instead.
In pseudo code := means assignment
whereas = means equality
a:=1 in pseudo code means a=1 in most languages
while, a=1 is generally used for conditional checking in pseudo code i.e. if(a=1) in pseudocode means if (a==1) in most languages
.
If you are talking about translating from another language, the := operator is used in pascal like languages for assigning variables.
In python the equivalent would just be =.
Pascal:
a := 1
Python:
a = 1
© 2022 - 2024 — McMap. All rights reserved.
:=
for the assignment operator. – Killer