KannadaScript Playground

Jai Karnataka 🎉

Documentation

kannadascript is dynamically typed toy programming language, based on an inside joke, written in Typescript.

General
namaskara is the entrypoint for the program and all program must end with matte sigona. Anything outside of it will be ignored.
This will be ignored

namaskara
// Write code here
matte sigona

This too
  
Variables
Variables can be declared using idu.
namaskara
  idu a = 10;
  idu b = "two";
  idu c = 15;
  a = a + 1;
  b = 21;
  c *= 2;
matte sigona
  
Types
Numbers and strings are like other languages. Null values can be denoted using khali. sari and thappu are the boolean values.
namaskara
  idu a = 10;
  idu b = 10 + (15*20);
  idu c = "two";
  idu d = 'ok';
  idu e = khali;
  idu f = sari;
  idu g = thappu;
matte sigona
  
Built-ins
Use helu to print anything to console.
namaskara
  helu "Hello World";
  idu a = 10;
  {
    idu b = 20;
    helu a + b;
  }
  helu 5, 'ok', khali , sari , thappu;
matte sigona
  
Conditionals
kannadascript supports if-else-if ladder construct , enadru block will execute if condition is sari, otherwise one of the subsequently added illa andre blocks will execute if their respective condition is sari, and the enu illa andre block will eventually execute if all of the above conditions are thappu.
namaskara
  idu a = 10;
  enadru (a < 20) {
   helu "a is less than 20";
  } illa andre ( a < 25 ) {
   helu "a is less than 25";
  } enu illa andre {
   helu "a is greater than or equal to 25";
  }
matte sigona
  
Loops
Statements inside ellivargu blocks are executed as long as a specified condition evaluates to sari. If the condition becomes thappu, statement within the loop stops executing and control passes to the statement following the loop. Use saaku nilsu to break the loop and munde nodu to continue within loop.
namaskara
  idu a = 0;
  ellivargu (a < 10) {
   a += 1;
   enadru (a == 5) {
    helu "andar se helu ", a;
    munde nodu;
   }
   enadru (a == 6) {
    saaku nilsu;
   }
   helu a;
  }
  helu "done";
matte sigona