Small Basic – When is an Equal Sign (=) a comparison?


When an equal sign (=) appears in a logical expression, it means it’s a comparison, not an assignment. For example, check out the code below:

 

If (num = 0) Then

  ‘ The rest of your life-changing code

EndIf

 

The first statement doesn’t change the value of the variable num to 0. It just tests the value of num against 0 and lets you know whether the answer’s true or false.

 

You can learn more about Small Basic over at http://blogs.msdn.com/smallbasic.

Small and Basically yours,

   – Ninja Ed & Majed Marji

Comments (1)

  1. Computers Today (part 1 of 6)

    blogs.msdn.com/…/computers-today.aspx

    …..

    CS SPOTLIGHT: Girls in computer programming… why it matters!!!

    blogs.msdn.com/…/cs-spotlight-girls-in-computer-programming-why-it-matters.aspx

    Computational Thinking – Videos & Papers by Jeannette Wing

    blogs.msdn.com/…/computational-thinking-videos-amp-papers-by-jeannette-wing.aspx

Skip to main content