Basic

Visual Basic .NET

Installation

Ubuntu
apt install mono-vbnc
Arch Linux
yay -S mono-basic

Examples

Fibonacci Numbers
' Fibonacci Numbers
Module Fibonacci

    Function Fib(ByVal N As Integer) As Integer
        If N < 2 Then
            Return N
        Else
            Return Fib(N - 2) + Fib(N - 1)
        End If
    End Function

    Sub Main(ByVal CmdArgs() As String)
        Dim N As Integer = Integer.Parse(CmdArgs(0))
        Console.WriteLine(Fib(N))
    End Sub

End Module

' example
'   compile:
'       vbnc /optimization+ /out:fib.exe fib.bas
'   run:
'       mono fib.exe 39
'       or
'       chmod +x fib.exe
'       ./fib.exe 39

FreeBasic

Installation

Arch Linux
pacman -S freebasic
Binary
# Download FreeBASIC-{version}-{os}-{arch}.tar.gz
tar xzf FreeBASIC-{version}-{os}-{arch}.tar.gz
cd FreeBASIC-{version}
./install.sh -i

Examples

Fibonacci Numbers
' Fibonacci Numbers
Function Fib(N As Integer) As Integer
    If N < 2 Then
        Fib = N
    Else
        Fib = Fib(N - 2) + Fib(N - 1)
    End If
End Function

Dim N As Integer = ValInt(Command(1))
Print Fib(N)

/'
    example
        compile:
            fbc -O 3 fib_fbc.bas
        run:
            ./fib_fbc 39
'/