From 05baee042b8d1ed0df5781ca0016162ebb5ee50b Mon Sep 17 00:00:00 2001 From: Stephen Chung Date: Fri, 31 Dec 2021 16:29:54 +0800 Subject: [PATCH] Add doc-comment example script. --- scripts/doc-comments.rhai | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 scripts/doc-comments.rhai diff --git a/scripts/doc-comments.rhai b/scripts/doc-comments.rhai new file mode 100644 index 00000000..9245065d --- /dev/null +++ b/scripts/doc-comments.rhai @@ -0,0 +1,20 @@ +/// The function `foo`, which prints `hello, world!` and a magic number, +/// accepts three parameters. +/// +/// # Parameters +/// +/// `x` - `i64` +/// `y` - `string` +/// `z` - `bool` +/// +/// # Notes +/// +/// This is a doc-comment. It can be obtained with the `metadata` feature. +/// +/// An example is the `rhai-doc` app. +/// +fn foo(x, y, z) { + print(`hello, world! ${if z { x + y.len() } else { x } }`); +} + +foo(39, "bar", true);