Output
Origin of Name and Use
Output is a print statement in Intext. Rather than follow the standard âprintâ word, I chose to make it as obvious as possible by using the keyword âoutputâ. Reason being, it wouldnât be hard to know which line is printing whatâs in output.
Simple Output
output "Hello World";
output 5;
Similar to Pythonâs print statement, but no parathesis and keyword being used is âoutputâ.
- Note: Disregarding what is being said in output, do not forget to use a semicolon at the end of each statement
Spaghetti Output
output "Population: " + 8.1 + "B";
output "Living equals " + true;
Theses lines are legal. Even tough itâs multiple types in one output statement, as long as they are separated by â+â symbols, itâs valid.
Spaghetti with variables
int declare x = 5;
string declare y = "Number: ";
output y + x;
Once again, this is valid. While it may not be outputting literals, variables work as well.
(Current) Limitations
output 2 + 2; // Will output 22, because output makes them into strings
These limitations will either be fixed in the future, or be implemented and maintained as a feature. This sections will change as time moves on.
RawAST Output Syntax
đ I recommend you check RawAST Syntax to better understand how these systems work!
{
"type": "output",
"value": "Hello, World!"
}
Making an Output Statement in RawAST is very simple, despite itâs verbosity. First, use the Super-Key type
, and give it the value of "output"
. Next, add comma at the end to follow JSONâs rules, and make the value
key next. Then, whatever you want to print, give that value to the value
key. Make sure if youâre outputting a string
(text), that it is wrapped in quotes. However, if you are printing the bool
of true
or false
, quotes are unneeded, along when outputting ints
such as 5.
Common Errors
- You misspell output
It happens to the best of us. The only way to defeat this error, is by checking through your code for typos. If enough people suggest, error-handling to catch these typos will be implemented.
- You type something illegal
I assume you have not read the entirety of this page if that is the issue. While Spaghetti Output may seem complex, itâs best to not overthink it, because if you do, depending on the version, it will return a silent output.
- You forgot the semicolon
This is very surprising. You likely tripped up. No worries, just make sure to not to forget next time.