-
Notifications
You must be signed in to change notification settings - Fork 1
Syntax
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.
YJLO Script supports both line comments // and block comments /* ... */, likes other C-like languages.
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
isValidDeclare 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.
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: bIntroduction
Langauge Guide
Libraries
- Utility
- ListUtil
- StringUtil
- Math
- Data Structure
- LinkedList
- Stack
- Heap
- HeapList
- HashMap
- HashSet
- Others
- UnitTest
- Tokenizer
Dev Reference
- Syntax Sugar