A paragraph (A.K.A. function or paragraph) is FiM++'s way of encapsulating code that runs. Very little code (Such as global variable declaration) runs outside paragraphs.

Related Phrases Edit

Here are the reserved phrases used in paragraphs:

Name Edit

Restrictions Edit

Each paragraph name has the following restrictions:

Freedoms Edit

Each paragraph name also has the following freedoms:

  • There is no hard limit on the length
  • May have any whitespace character in them
  • May contain operators that do not share a name with keywords
  • May contain literals, as long as they are not at the beginning of the name
  • May contain apostrophes, as they are not punctuation
  • Encoded in UTF-8

Examples Edit

Here are some examples of good paragraph names:

  • how to fly
    • Paragraph names can have spaces in them.
  • something simple
    • Paragraph names don't have to start with "how to".
  • how to sing Applejack's Drinking Song
    • Even though ' is used to declare character literals, it is used in the middle of a name, so it is okay.
  • when to tell True Facts
    • Even though true is a literal, FiM++ is case-sensitive, so True is valid for paragraph naming.
  • why Cloud 9 is the best hotel in Cloudsdale
    • Even though 9 is a number literal, it is not at the beginning of the paragraph name

Here are some examples of bad paragraph names:

  • why I learned
    • I learned is a keyword, so this will not compile.
  • how to multiply
    • "multiply" is an operator, so this will not compile.
  • about Applejack, Rarity, and Rainbow Dash
    • compiler thinks "," is the end of the paragraph name "about Applejack", and doesn't know what to do with the rest
  • about Friendship and Magic
    • "and" 'is an operator and keyword.
  • 'sarcasm' uses quotes
    • ' is used to start a character literal (such as 'a', so the compiler sees this as an unclosed character literal.
  • 99 ways to get salted
    • 99 is always a literal, so it cannot be the beginning of a paragraph name. Additionally, the compiler doesn't know how to handle the rest of the line.

Declaration Edit

Main article: Paragraph Declaration

Paragraphs are declared with the text "I learned", followed by the name of the paragraph and a punctuation. Mane paragraphs start with "Today I learned". Return types can be left blank for a void return type, or will follow the paragraph name and the word "with" or "as. Parameters (values that are sent to the paragraph) follow the return type and the word "using" and are separated from each other with "and".

Returning Edit

In order to return a value from a paragraph, the the phrase "Then you get" is used, followed by the returned value, followed by punctuation. Returned values can be paragraphs, variables, or literals. Returned values must be the same type as is specified in the paragraph declaration.

Example Edit

Then you get the result.

Closing Edit

Paragraphs are closed with the phrase "That's all about", followed by the paragraph's name, followed by a punctuation.

Example Edit

That's all about how to multiply!

Calling Edit

When used to read, store, or return a value, paragraphs are called in the same context as a variable; simply use the name of a paragraph instead of the name of a variable. Parameters can be specified just like they are declared (using "using"). To call a paragraph and ignore its returned value, start a line with "I remembered" or "I would, followed by the paragraph name and any parameters, then the punctuation.

Examples Edit

Calling a paragraph and ignoring its return value:

I remembered how to count.

Storing the return value of a paragraph into a variable after passing the paragraph two parameters:

The number of pies is now how to multiply using cakes and cookies.

Mane Paragraphs Edit

Mane paragraphs are paragraphs that run without being explicitly called by code. They can also be run by being called in the code. When the program is run, each mane paragraph is run once, in order of declaration.

Ad blocker interference detected!

Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.