ddonche/goblin-lang
0.46.24
1
0
docs reference
[[act]]

Act


Act declares an action. This is similar to how other languages use fn or def.

/// rust
fn main() {
    println!("Hello, world!");
}

/// ruby
def hello_world
  puts "Hello, World!"
end

/// goblin
act hello_world
  :say "Hellow, World!"
xx
/// rust
fn main() {
    println!("Hello, world!");
}

/// ruby
def hello_world
  puts "Hello, World!"
end

/// goblin
act hello_world
  :say "Hellow, World!"
xx


Overview

act is Goblin's primary keyword for creating callable logic.

If it can be called, Goblin considers it an action.

act greet(name)
    :say("Hello, {name}!")
xx
act greet(name)
    :say("Hello, {name}!")
xx

Calling the action:

greet("Goblin")
greet("Goblin")

Output:

Hello, Goblin!
Hello, Goblin!

And you can do it on a single line, too:

act greet(name) => :say("Hellow, {name}!")
act greet(name) => :say("Hellow, {name}!")

Try it in the REPL:


Alias

act and action are identical.

act greet(name)
    :say("Hello!")
xx

action greet(name)
    :say("Hello!")
xx
act greet(name)
    :say("Hello!")
xx

action greet(name)
    :say("Hello!")
xx

Goblin documentation generally uses act because it is shorter.