UFB Wiki

The UFB (Unsafe Four Bit) Programming Language -- FAST | EASY | VERBOSE -- Built With Rust

View on GitHub


Variables


All languages have variables built-in in their own right.

UFB only has one variable type though: array of characters.

Variables can be placed into the Read-Write Memory or the Read Only Memory.

ROM:  0 - 37  = ' ', 'A'-'Z', '0'-'9', '\n'
RWM: 38 - 255 = '\u0000'

You can access these variables (no matter their length) by specifying their memory index.

It can, for some reason, be done in many different ways... as expected.

// The default way of doing it.
38

// Inside a string.
"$038"

// A string literal.
"Hello!"

// Using a label.
label 38 var
${var}
There are many more ways of doing this, but those are the basics!


Here are some basic commands for manipulating the memory:

/* Write a variable at memory index 38 that contains the data:
 "Hello! How are you?" */
wvar 38 "Hello! How are you?"

// Trim memory index 38 so that it would only have a length of 6 characters.
trim 38  6

// Annihilate memory index 38; free a memory index for future use.
nvar 38

// This accepts user input and stores the data to memory index 38.
read 38

// Print the data in memory index 38 to the terminal.
print "$038\n"


⏪️