The print
prints the specified message to the screen, or other standard output device 💻.
The message can be a character 🔠, or a number 🔢, the object will be converted into a string before written to the screen.
tldr;
- Print stuff to the screen.
- Print the pointer value or value in the memory or any number.
- Print ASCII characters.
The ASCII
But printing numbers alone is not that useful. Here's how we can print almost any character 🔠. To do this, Infant Lang makes use of the ASCII table.
In the ASCII table, the numbers, characters, symbols as we know them, are assigned to a number. This number can be passed to the char
that prints the ASCII equivalent of the number.
tip
Find out the ASCII equavalents from this table.
Special Characters
Print also have special keywords that can be used to print the following:
new
for printing a new linetab
for printing a tabspace
for printing a space
- New Line
- Tab
- Space
print new
print tab
print space
danger
Adding no tokens such as a number or memory or pointer or the above special characters will throw an error and stops the execution of the program.
- Correct
- Wrong
# Correct ✅ This will move the cursor to the next line
print new
# Wrong - ❌ This will throw an error ❌
print
The char
Remember Infant Lang also prints the ASCII equivalent of the number? It uses this char
keyword to print the ASCII equivalent of the number. Let's see how it works:
To print the letter A
, we must know the ASCII equivalent of the letter.
info
The ASCII equivalent of A is 65
We then print the char of 65
. We can pass number or pointer or the memory to the print
- Direct Print
- With Memory
- With Pointer
print char 65
memory = 65
print char memory
move pointer right 65
print char pointer
The Output is:
A
caution
The char
keyword can only print the ASCII equivalent of the number 🔢
It is case sensitive 👩💻
This is still a work in progress. It may or may not print Unicode characters which depends on the the terminal 💀