So, like in an other programming language, small basic also has got its keywords!
They’re a little different from other programming languages, like the key words are slightly longer. For instance, in python, to print a line the code is print = “hello world”; here it’s TextWindow.WriteLine(“hello world ” + “!”) or TextWindow.Write(“hello world ” + “!”); they might look a lil’ similar but there is a LOT of difference between the two!
Today, we’ll be talking about about text-related input and output functionalities. Using this class, it is possible to write or read some text or number to and from the text-based text window.
TextWindow.WriteLine
This is how it looks in the compiler
This is the result
TextWindow.Write
This is how it looks in the compiler
This is the result
As you can see, there is a lot of difference between the two… here in small basic, without using lists, we can print out the code in a straight line!
This is a very efficient shortcut that small basic has as it helps while typing big programs, for instance
This is a program to find the list of pythogarean triplets from a range of 1–10. In this peice of code, I’ve used TextWindow.Write
This is the output
In this peice of code, I’ve used TextWindow.WriteLine
This is the output
There is a visible difference between the two types of code. TextWindow.Write makes it easier to understand the output of the code.