Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Functions

Dhruvan edited this page Oct 30, 2022 · 3 revisions

This is how Functions works in Versace

Functions

  • Functions are objects that can be called and executed.
  • In verscae, functions can be anywhere in the code.
  • There also exists a main function, which is the entry point of your code.
  • Versace has async functions, which means that they can be called and executed at the same time.
  • Functions are written in the following format:
func (name)(args) {
    (statements)
}
  • Example:
func say_hi() {
    in name < "What is your name? " < green < endl
    out < f"Hello, my name is {name}" < red
}

func say_bye(name) {
    out < f"Goodbye {name}" < green
}
  • Asynchronous functions are written in the following format:
async func (name)(args) {
    (statements)
}
  • Example:
async func say_hi() {
    in name < "What is your name? " < green < endl
    out < f"Hello, my name is {name}" < red
}
Clone this wiki locally