Skip to content

Variable and Data Types

Data Types

Mufi-Lang has the following data types:

NameSizeType
int2/4 bytesPrimitive
double8 bytesPrimitive
bool1 bytePrimitive
complex16 bytesPrimitive
stringvariableObject
fvecvariableObject
linked listvariableObject
hash tablevariableObject

Array and Matrix Removal

The array and matrix data types have been removed from Mufi-Lang as of version 0.8.0. We are working on having fvec be the default array type for numerical types as it can take advantage of SIMD instructions and is more memory efficient. The matrix type will return once we have done the research of the best implementation and build it to take advantage of SIMD operations.

Operators

OperatorDescription
+Addition
-Subtraction
*Multiplication
/Division
%Modulus
==Equality
!=Inequality
>Greater than
<Less than
>=Greater than or equal to
<=Less than or equal to
!Logical NOT
andLogical AND
orLogical OR
+=Addition Assignment
-=Subtraction Assignment
*=Multiplication Assignment
/=Division Assignment
++Increment
Decrement

Variables

Variables are used to store data, and are declared using the var keyword. You may choose to initialize the variable with a value or not. If you do not initialize the variable, it will be initialized with nil.

var a = 10;
var b; // or var b = nil;

Global and Local Scopes

Variables can be declared in the global scope or local scope. Global variables are declared outside of any function and can be accessed from anywhere in the program. Local variables are declared inside a function and can only be accessed within that function.

var a = 10; // Global
fun foo() {
var b = 20; // Local
}
print b; // Undefined variable 'b'.