DEV Community

loading...

Discussion on: Show me your best Open Source project

Collapse
lechatthecat profile image
lechat • Edited

GitHub logo lechatthecat / oran

Programming language written by rust

Oran

Programming language written by rust
Still in development

Syntax

This is a scripting language. Syntax is as follows:

fn hello () {
    println("Hello World")
}
Enter fullscreen mode Exit fullscreen mode
fn test () {
    let test = 'hey'
    println(test)
}
test();
Enter fullscreen mode Exit fullscreen mode
fn test () {
    let test = ' test';
    for i in 0..5 {
        println(i << test);
    }
}
test();
Enter fullscreen mode Exit fullscreen mode

Please note that you need "mut" for mutable variables.

fn test () {
    let mut test = 'hey'; // here
    test = "hello"; 
    println(test);
}
test();
Enter fullscreen mode Exit fullscreen mode

You can see many other examples in examples/example.orn

Example

Calculate n-th of Fibonacci sequence:

fn fib (n) {
  let mut f0 = 0
  let mut f1 = 1;
  let mut f2 = 0;

  for i in 1..n {
    f2 = f1 + f0;
    f0 = f1;
    f1 
Enter fullscreen mode Exit fullscreen mode