Highly dynamic and powerful scripting language
print("Hello, world!")
// single line comment
/* block comment */
You can perform basic arithmetics like addition, subtraction, multiplication, etc.
1 + 2
5 - 10
3 * 4
50 / 7
36 % 5
Use let
keyword to declare an immutable variable.
let x = 5
let y = x + 10
print(y) // 15
You can add !
to make the variable mutable.
let! a = 0
a = 5
print(a) // 5
a += 2
print(a) // 7
Use if
expression to execute a block based on conditions.
let x = 10
if x > 5 {
print("x is greater than 5")
}
You can use else
to handle the other case.
let today = "Monday"
if today == "Saturday" || today == "Sunday" {
print("It's weekend!")
} else {
print("It's weekday :(")
}
Use iter
and of
keywords to iterate over an array.
let friends = [
"abiria"
"andjsrk"
"kangjun"
"ensuta"
]
iter friends of person {
print("Hello, " + person + "!")
}
$ git clone https://github.com/abiriadev/dyn && cd dyn
$ cargo install --path ./crates/cli
$ dyn
# if you want to execute a script, pass the file path as an argument
$ dyn ./examples/hello.dyn
- REPL
- Closure
- LSP