For Beginners

Lesson 7/18

Bad Characters!

In the previous lesson you saw where variables take their values from and how you can make operations on them. But the results of these operations may vary, depending on a character you use for embracing the operation.

Run this script:

♥number = 2
dialog ♥number+♥number

The dialog displays 4 — the result of adding 2 and 2, which are the values of the ♥number variable. Now try this:

♥number = 2
dialog ‴♥number+♥number‴

Now you see 2+2 in the dialog. What happened? The answer lies in the character. Do you remember it? It is used to embrace strings (texts) containing spaces. In this case, the expression ‴♥number+♥number‴ is treated as text, so the robot just inserts the value of the ♥number variable on both sides of the + sign and displays it all as text, not the result of a mathematical operation.

The next lesson will be useful for ones who mastered C# language and Microsoft .NET Framework.