2021-12-31 09:29:54 +01:00
|
|
|
/// The function `foo`, which prints `hello, world!` and a magic number,
|
|
|
|
/// accepts three parameters.
|
|
|
|
///
|
|
|
|
/// # Parameters
|
|
|
|
///
|
2022-01-20 05:06:36 +01:00
|
|
|
/// * `x` - `i64`
|
|
|
|
/// * `y` - `string`
|
|
|
|
/// * `z` - `bool`
|
2021-12-31 09:29:54 +01:00
|
|
|
///
|
|
|
|
/// # Notes
|
|
|
|
///
|
|
|
|
/// This is a doc-comment. It can be obtained with the `metadata` feature.
|
|
|
|
///
|
|
|
|
/// An example is the `rhai-doc` app.
|
|
|
|
///
|
2022-01-20 05:06:36 +01:00
|
|
|
/// # Example
|
|
|
|
///
|
|
|
|
/// ```rhai
|
|
|
|
/// let x = foo(42, "hello", true);
|
|
|
|
///
|
|
|
|
/// print(x); // prints 47
|
|
|
|
/// ```
|
2021-12-31 09:29:54 +01:00
|
|
|
fn foo(x, y, z) {
|
|
|
|
print(`hello, world! ${if z { x + y.len() } else { x } }`);
|
|
|
|
}
|
|
|
|
|
|
|
|
foo(39, "bar", true);
|