Small Basic - Combining Strings and Variables

Combining Strings and Variables

Be careful when you want to display variable contents as strings! These two statements are different:

TextWindow.WriteLine("x")

TextWindow.WriteLine(x)

   

The first statement displays the literal string "x" on the screen. The second statement displays the value of the variable x.

You can mix strings and numbers using the plus sign. For example, let’s say x = 7 and y = 5 in this statement:

TextWindow.WriteLine("What is " + x + "+" + y + "?")

  

This displays the string "What is 7+5?" on the screen.

 

Head to https://blogs.msdn.com/SmallBasic to download Small Basic and learn all about it!

 

Have a Small and Basic day!

   - Ninja Ed & Majed Marji