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 Nov 26, 2022 · 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

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:

file_create("file.txt"); /* Create a file */
file_delete("file.txt"); /* Delete a file */
file_overwrite("file.txt", "foo"); /* Overwrite a file with something */
file_write("file", "foo"); /* Write something to a file*/

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 */

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