Syntax | Rule |
Annotations | All annotations must start with a number sign (#). Example: # This is annotation. |
Identifier | - Identifiers are case-sensitive. An identifier can contain letters, digits, and underscores (_). Identifiers cannot start with a digit.
- All names of built-in variables, custom variables, built-in functions, and custom functions must comply with the identifier conventions.
|
Data type | - String
Literal constants: use a pair of single quotation marks (') to quote a literal constant, for example, 'hello, EdgeScript' . - Number
Literal constants: decimal numbers, for example, 10, -99, or 1.1. - BOOLEAN
Literal constants: true or false. - Dictionary
Literal constants: - []: an empty string.
['key1', 'key2', 100] : 1 -> 'key1' 2 -> 'key2' 3 -> 'key3'
['key1' = 'value1', 'key2' = 1000] 'key1' -> 'value1' 'key2' -> 1000
|
Variable | |
Operator | |
Clause | - Condition clause
if condition {
...
}
if condition1 {
if conditon2 {
...
}
}
if condition {
...
} else {
...
}
- Clause descriptions
- for loop
a = ['a', 'b', 'c', 'd']
def for_func () {
for k, v in a {
if eq(v, 'c') {
return true
}
}
}
for_func()
##########################################################################################
a = ['a' = 1, 'b' = 2, 'c' = 3, 'd' = 4, 'e' = 5, 'f' = 6]
def for_func () {
for k, v in a {
if eq(k, 'c') {
return true
}
}
}
for_func()
##########################################################################################
num = 0
def for_func () {
a = [0,1,2,3,4,5,6,7,8,9]
for k ,v in a {
b = [0,1,2,3,4,5,6,7,8,9]
for k1 ,v1 in b {
c = [0,1,2,3,4,5,6,7,8,9]
for k2 ,v2 in c {
num = add(num, 1)
if and(eq(v, 3), eq(v1, 5), eq(v2, 7)) {
return true
}
}
}
}
}
for_func()
- Take note of the following limits:
|
Function | |
Remarks | You must not use double quotation marks (") in EdgeScript. |