Skip to content
This repository has been archived by the owner on Aug 31, 2024. It is now read-only.

Documentation

Kick de Gans edited this page Jan 16, 2023 · 25 revisions

1: Basics

2: If statements

3: Loops





1: Basics:

Using the interpreter:

Checking if the runtime is properly installed:

fusion --verify

Opening and running a file

fusion file.fn

Adding your own libraries

sudo fusion-packages --add-library <file>

Updating the environment:

sudo fusion-packages --update

IO:

Printing ASCII text:

print("Hello world!"); /* Print without newline */
println("Hello world!"); /* Print with newline */

User input:

input("Enter your name:"); /* Returns the value the user inputted */

Reading and writing to files:

var file = open("file", options); /* Open file */
read(file); /* Read file */
write(file, "content"); /* Write to file/stream */

Variables:

Declaring variables:

string foo = "bar"; /* String */
int foo = 5; /* Integer */
double foo = 1.23; /* Double */
float foo = 0.45; /* Float */
bool foo = true; /* Boolean */
var foo = value; /* Any type */

Declaring constant variables (Readonly):

const string foo = "bar"; /* String */
const int foo = 5; /* Integer */
const double foo = 1.23; /* Double */
const float foo = 0.45; /* Float */
const bool foo = true; /* Boolean */
const var foo = value; /* Any type */

Declaring public variables (Global):

public string foo = "bar"; /* String */
public int foo = 5; /* Integer */
public double foo = 1.23; /* Double */
public float foo = 0.45; /* Float */
public bool foo = true; /* Boolean */
public var foo = value; /* Any type */

You cant also combine public and const to make a constant public variable

Functions:

Declaring functions:

fn foo() /* No arguments*/
{
    ...
}
fn foo(bar) /* Arguments */
{
    ...
}
fn foo() ... /* Consise function */

2: If statements:

if (condition) /* If statement */
{
    ...
}
elseif (condition)
{
    ...
}
else
{
    ...
}

3: Loops:

Normal loops:

while (condition)
{
    ...
}
until (condition)
{
    ...
}
dowhile (condition)
{
    ...
}
dountil (condition)
{
    ...
}

For loop:

for (foo : bar)
{
    ...
}
Clone this wiki locally