Overview

Documentation

What it is

Ninja programming language is built with inspiration from Javascript and PHP, the main goal is to be a general scripting language, that can be embedded into other bigger system.

Get Started

Installation Homebrew brew tap gravatalonga/ninja-lang brew install ninja-lang YUM / RPM To enable, add the following file /etc/yum.repos.d/ninja.repo: [ninja] name=Ninja Programming Language baseurl=https://yum.fury.io/gravatalonga/ enabled=1 gpgcheck=0 Check if correctly created yum --disablerepo=* --enablerepo=ninja list available To install you only need run following command: yum install ninja-lang APT To configure apt access, create a following file /etc/apt/sources.list.d/ninja.list with content of : deb [trusted=yes] https://apt.fury.io/gravatalonga/ / Or use this one line command:

Variables

Here is a summary of the different types of variables and how to declare them in Ninja programming language: Numbers Numbers in Ninja can be either integers (whole numbers), floats (numbers with a decimal point), Scientific Notation or Hexadecimal Number. To declare a number, use the var keyword followed by the name of the variable you want to create, and then assign it a value. For example: var a = 1; // declares an integer var b = 2.

Operators

Operators && Logics Operators Logical Operators 10 < 10; // FALSE 10 > 10; // FALSE 10 == 10; // TRUE 10 != 10; // FALSE 10 <= 10; // TRUE 10 >= 10; // TRUE 10 && 10; // TRUE 10 || 10; // TRUE !10; // FALSE !!10; // TRUE Arithemetics Operators 1 + 1; // SUM 1 - 1; // SUBTRACT 1 / 1; // DIVIDER 1 * 1; // MULTIPLE 4 % 2; // MOD 10 ** 0; // POW 10 & 2; // AND Bitwise operator 10 | 2; // OR Bitwise operator 10 ^ 2; // XOR Bitwise operator 10 << 2; // Shift left (multiply each step) 10 >> 2; // Shift right (divide each step) ++1; // First increment and then return incremented value --1; // First decrement and then return decremented value 1++; // First return value and then increment value 1--; // First return value and then decrement value Value is truthy when is not nil or false.