viri

A simple, expressive programming language

A taste

fun fibonacci(n) {
  if (n <= 1) return n;
  return fibonacci(n - 1) 
       + fibonacci(n - 2);
}

print fibonacci(10);

var multiply = fun(a, b) {
  return a * b;
};
print multiply(3, 4);

// IIFE
print fun(x) { return x * x; }(5);
class Animal {
  init(name) {
    this.name = name;
  }
}

class Dog < Animal {
  init(name){
    super.init(name);
  }

  speak() {
    print this.name + " barks";
  } 
}

var rex = Dog("Rex");
rex.speak();
import "math" as m;

print m.pi;
print m.pow(2, 3);

// easy to use modules
// for code organization
var list = [1, 2, 3];
print list[0];

var dict = {
  "name": "Viri",
  "ver": 1
};
print dict["name"];

for (var i = 0; i < 10000; i = i + 1){
  print i;
}
  

What you get

Classes & inheritancedefine methods and reuse behavior via single inheritance
Functionsnamed functions with lexical scoping
Closuresfunctions capture surrounding lexical scope
Module systemfile-based modules with explicit exports and alias-based imports
Const bindingsimmutable names when you want them
Arrays & hashesbuilt-in indexed and key-value data structures