Emojicode Documentation 1.0 beta 2

The Basics

This chapter reviews the basics of Emojicode that occur in mosts programs or are of importance in the following sections of this Language Reference & Guide.

Source Files

Emojicode source files are UTF-8 encoded text documents in accordance with the syntax specified by the grammar in this documentation.

Source code files must have the extension .πŸ‡ or .emojic.

The 🏁 Block

The 🏁 block is an important part of any Emojicode program as it is the part of the program that is executed when it is started.

Here’s an example of a 🏁 block:

🏁 πŸ‡
   πŸ’­ Get things up and running here...
πŸ‰

The 🏁 block can also return an integer which is then used as the exit code:

🏁 ➑️ πŸ”’ πŸ‡
   πŸ’­ Get things up and running here...

  ↩️ 0  πŸ’­ Return a code here.
πŸ‰

Comments

We have seen examples of comments in the previous code samples. Comments allow you to include non-executable text in your code.

Comments begin with πŸ’­ and end at the end of the line. For example:

πŸ’­ This comment ends at the end of the line. Exactly here

You can also use another type of comment that spans multiple lines: Multiline comments starts with πŸ’­πŸ”œ and ends with πŸ”šπŸ’­ and can contain line breaks:

πŸ’­πŸ”œ This is a multiline comment. You can even make
line breaks. πŸ”šπŸ’­

So... When to Use Emojis?

There’s sometimes confusion when emojis are used. Basically it’s very simple:

All type, method and initializer names are emojis. On the other hand variables cannot include emojis but must be any combination of characters that cannot be confused with numbers.

Including Other Source Code Files

The Emojicode compiler always expects a single file. Nevertheless, you can include other source code files. Simply speaking, this just inserts the code from the included file.

Syntax:

πŸ“œ πŸ”€path/to/a/file.emojicπŸ”€
πŸ“œ πŸ”€file.emojicπŸ”€

The path is relative to the directory in which the current source document is.

Hint

Do not use this method to share code across projects. If you have written really fancy code, create a package, which you can easily make available to other people.

← Previous Next Up: β€œLiterals” β†’
Something not quite right? Improve this page