Search code examples
pseudocode

What does "while a <> b" mean in pseudocode?


In an assignment we are to use a specific algorithm to find the greatest common divisor in assembly, written in assembly.

The algorithm is as follows:

Input:a,b
Local: c
 While a <> b
     While a > b
         c = a - b
         a = c
     End While
     While b > a
         c = b - a
         b = c
     End While
End While
At this point, GCD(a,b)=a=b.  

What does a <> b mean in the third line?


Solution

  • In certain old languages, the <> operator meant "not equal" (you can see it as "less than or greater than"). The convention != has largely taken over nowadays.