T# is a interpreted progamming language designed to be as easy to understand as physically possible. It uses a relaxed syntax, where you can define objects by just typing in it's contents, instead of using syntax like "", '', {}, (), and []. T# also uses plain english over abbreviations where possible.
To create a T# Program, I suggest you use my online editor/compiler. (this of course)
To output to the console, you can use the output function:
output Hello, World!
An example of a simple T# program is already included in the editor, but if you are making your own program, you will need to refer to this Wiki often unless you somehow learned the entire T# language in 1 day.
As shown earlier, the output function is used to output strings to the console. However, there is also another function called "ask" that lets you get input from the user:
ask What is your favorite color?
The ask function outputs all user input to a virtual variable named "result". All functions that return a value also output to the virtual variable "result", so make sure you store it's output in another variable.
Here is an example of ask being used with output:
ask What is your favorite color?
output My favorite color is :result: too!
Now that you've learned how to output to the console and use the ask function to get use input, you can start using variables.
To create a variable, you can assign it a value and it will be automatically created for you:
set mitochondria to The powerhouse of the cell
Please keep in mind that the name of the variable cannot contain spaces.
To refer to variables in functions, such as output, ask, if statements, exc. you will have to use the variable name surrounded in :, like you're sending an emoji in a messaging app:
output The mitochondria is :mitochondria:
Output: The mitochondria is The powerhouse of the cell
If statements are a powerful and essential part of any programming language. Luckily, T# makes If statements easy!
To use an If statement, create a line of code line this:
if ... then
end
Or, for an If-Else statement:
if ... then
else
end
To make a simple if statement, there are 2 main parts: The condition, and the code. The condition part is simple: the first input, the operator, and the second input. There are 4 operators: is, isn't, exceeds, and subceeds.
The "is" and "isn't" operators take both strings and numbers, however the "exceeds" and "subceeds" operators take exclusively numbers. The "is" operator compares two values, and checks if they are the same. The "isn't" operator is identical, except that it checks if the two values are different. Here's an example:
if one is two then
output This shouldn't be possible!
else
output If you're seeing this, the code ran correctly.
end
if one isn't two then
output But this is possible!
end
And the number only operations:
if 1 exceeds 2 then
output This shouldn't be possible!
else
output If you're seeing this, the code ran correctly.
end
if 1 subceeds 2 then
output But this is possible!
end
A more complex program like a calculator needs math. T# provides the basic math functions:
add Adds all of it's parameters and outputs the result to the :result: variable
subtract Subtracts 2nd parameter by the 1st parameter and outputs the result to the :result: variable
multiply Multiplies the 1st parameter by the 2nd parameter and outputs the result to the :result: variable
divide Divides the 1st parameter by the 2nd parameter and outputs the result to the :result: variable
random Returns a random decimal number between 0 and 1 and outputs the result to the :result: variable
round Rounds the 1st parameter outputs the result to the :result: variable
# Add comments to your code
restart Stops and restarts the program from the beginning
break Stops the program completely