💾 Archived View for rawtext.club › ~sloum › nimf › guide › 08-characters.gmi captured on 2023-04-26 at 13:36:44. Gemini links have been rewritten to link to archived content

View Raw

More Information

⬅️ Previous capture (2023-01-29)

-=-=-=-=-=-=-

 ____ ____ ____ ____ 
||n |||i |||m |||f ||
||__|||__|||__|||__||
|/__\|/__\|/__\|/__\|

the nimf guide : characters

This will likely be a short chapter. There is not much to characters in nimf. A character is really just a number representing a unicode code point (which includes the ascii range of characters in their usual numbering). There is a builtin, `emit`, which will take an integer from the stack and output the character with that number. The following code will output the letter `h`:

104 emit

That is well and good, but is a little annoying when looking at source code. Wouldn't it be nicer to type the actual character you intend? With a bit of syntactic sugar, you can:

`h emit

A backtick followed by a single character will add the numerical value of that character to the stack. It can then be used for output as a character or operated on as a number. This ability also includes all of the same escape characters that work in strings. Here are a few common ones:

That is about all there is to using characters in nimf. Remember that strings are stored as integers representing individual characters like this as well. So if you itterate over a string you can `emit` the values (which is how many of the various output words are written).

________________________________________________

PREV: numbers

NEXT: strings

the nimf guide