Skip to main content

Print

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 line
  • tab for printing a tab
  • space for printing a space
print new
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 ✅ This will move the cursor to the next line
print new

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

print char 65

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 💀