[Tex/LaTex] Assignment vs Add to collection in Latex

algorithms

I am writing an algorithm in latex and don't know how to distinguish between assignment and collection operations.

Assignments be written as:
A <- B + C

But in case of add to collection, I usually do

A <- {}
loop condition:
  A <- A + X

Is there anything else that I can use instead of \leftarrow and not have to write A + X on the right always.

Thanks in advance

Best Answer

I don't think there is a standard for pseudocode. You could write it in a somewhat object-oriented way like this:

  A.insert(X)

In pseudocode I would also avoid + to merge sets, and would rather use the set union symbol, ∪.

Related Question