This is a basic tutorial covering the basics of TexScript for first users. See the [Data Types] and [Commands] pages for more information.
Spaces are very important in TexScript. Be sure to use them correctly or undesired behavior may occur!
If you are using Windows, press the Return/Enter key where you would type a space. For example, int a ;
would become int
(Return/Enter key) a
(Return/Enter key) ;
(Return/Enter key).
Mac:
Open TexCode (see [Download and Install] for instructions).
Type in the code: int a ;
, then press the Return/Enter key.
The above code initializes a variable with data type int
and name a
.
Type in the code: set a to 1 ;
, then press the Return/Enter key.
The above code sets a
to 1. We could have taken a shortcut and just said int a = 1
, but I wanted to show you more aspects of TexScript. However, I do recommend use the shortened version when coding.
Type in the code: retrieve a
, then press the Return/Enter key.
The above code retrieves the value of a
and outputs it to the console. After you press enter, you'll notice that 1
appears below your input, as 1
is the value of a
.
Type in the code: set a to 6 ;
, then press the Return/Enter key.
The above code sets the value of a
to 6.
Type in the code: int b = 2
, then press the Return/Enter key.
The above code initializes a variable with data type int
, name b
, and value 6.
Type in the code: if a is b
, then press the Return/Enter key.
You'll notice that the console will output 0, computer "language" for false. As 1 (the value of a
) is not 6 (the value of b
), the console will return false. Note that you can also use isn't
to compare if variables are not equal to each other. The greater than and less than symbols are also available for comparing variables' values.
Finally, type in the code: print hello
.
You'll notice that the console outputs hello
.
You can also initialize variables with data types string
, char
, and bool
.
I hope you learned a lot! Please feel free to ask any questions about what you learned on the Discussion page!
Wiki: Commands
Wiki: Data Types
Wiki: Download and Install
Wiki: Home