Skip to content
Liu Siwei edited this page Apr 30, 2017 · 8 revisions

YJLO Script has similar syntax as JavaScript with support for higher order functional programming and object-oriented programming. Semicolon separator at the end of each statement is mandatory.

Comments

YJLO Script supports both line comments // and block comments /* ... */, likes other C-like languages.

Identifiers

YJLO Script is a case-sensitive language. Identifiers start with a letter and may contain letters, digits, and underscores.
The following examples are all valid identifiers:

a
count
sum2
Hello_World
isValid

Declare a variable with an initial value:

var myVar = "Hello";

Declare multiple variables in one line:

var a = 0, b = "abc", c;

All variable's default value is null if the initial value is not given.

Scope

Unlike JavaScript (ES5 and older versions), YJLO Script is block-scoped. Every pair of braces {} defines a new scope. Local variables declared in a scope are visible to its own scope as well as all sub-scopes, but invisible to its parent-scopes.

var a = 1;
func bar(){
	var a = 2;
	var b = 3;
	print( a );		// output 2
	if (true) {
		print( b );	// output 3
		var c = 4;
		print( c );	// output 4
	}
	print( c );		// Error: Cannot find variable: c
}
bar();
print( a );		// output 1
print( b );		// Error: Cannot find variable: b

Introduction

Langauge Guide

Libraries

  • Utility
    • ListUtil
    • StringUtil
    • Math
  • Data Structure
    • LinkedList
    • Stack
    • Heap
    • HeapList
    • HashMap
    • HashSet
  • Others
    • UnitTest
    • Tokenizer

Dev Reference

  • Syntax Sugar
Clone this wiki locally