Use //! for script docs.
This commit is contained in:
parent
e8d6e3f57d
commit
45acb65f4f
@ -1,4 +1,4 @@
|
|||||||
// Implementation of the Event Handler With State Pattern - JS Style
|
//! Implementation of the Event Handler With State Pattern - JS Style
|
||||||
|
|
||||||
/// Initialize user-provided state.
|
/// Initialize user-provided state.
|
||||||
fn init() {
|
fn init() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Implementation of the Event Handler With State Pattern - Main Style
|
//! Implementation of the Event Handler With State Pattern - Main Style
|
||||||
|
|
||||||
/// Initialize user-provided state (shadows system-provided state, if any).
|
/// Initialize user-provided state (shadows system-provided state, if any).
|
||||||
fn init() {
|
fn init() {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// Implementation of the Event Handler With State Pattern - Map Style
|
//! Implementation of the Event Handler With State Pattern - Map Style
|
||||||
|
|
||||||
/// Initialize user-provided state.
|
/// Initialize user-provided state.
|
||||||
/// State is stored inside an object map bound to 'state'.
|
/// State is stored inside an object map bound to 'state'.
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script contains a single assignment statement.
|
//! This script contains a single assignment statement.
|
||||||
|
|
||||||
let x = 78;
|
let x = 78;
|
||||||
|
|
||||||
|
@ -1,3 +1,5 @@
|
|||||||
|
//! This script illustrates how to put doc-comments on functions.
|
||||||
|
|
||||||
/// The function `foo`, which prints `hello, world!` and a magic number,
|
/// The function `foo`, which prints `hello, world!` and a magic number,
|
||||||
/// accepts three parameters.
|
/// accepts three parameters.
|
||||||
///
|
///
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
// This script calculates the n-th Fibonacci number using a really dumb algorithm
|
//! This script calculates the n-th Fibonacci number using a really dumb algorithm
|
||||||
// to test the speed of the scripting engine.
|
//! to test the speed of the scripting engine.
|
||||||
|
|
||||||
const TARGET = 28;
|
const TARGET = 28;
|
||||||
const REPEAT = 5;
|
const REPEAT = 5;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs for-loops.
|
//! This script runs for-loops.
|
||||||
|
|
||||||
let arr = [1, true, 123.456, "hello", 3, 42];
|
let arr = [1, true, 123.456, "hello", 3, 42];
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs for-loops
|
//! This script runs for-loops
|
||||||
|
|
||||||
const MAX = 1_000_000;
|
const MAX = 1_000_000;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs for-loops with closures.
|
//! This script runs for-loops with closures.
|
||||||
|
|
||||||
const MAX = 100;
|
const MAX = 100;
|
||||||
const CHECK = ((MAX - 1) ** 2) * MAX;
|
const CHECK = ((MAX - 1) ** 2) * MAX;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script defines a function and calls it.
|
//! This script defines a function and calls it.
|
||||||
|
|
||||||
fn call_me() {
|
fn call_me() {
|
||||||
return 3;
|
return 3;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script defines a function with two parameters and local variables.
|
//! This script defines a function with two parameters and local variables.
|
||||||
|
|
||||||
let a = 3;
|
let a = 3;
|
||||||
|
|
||||||
|
@ -1,5 +1,4 @@
|
|||||||
// This script defines a function with many parameters.
|
//! This script defines a function with many parameters.
|
||||||
//
|
|
||||||
|
|
||||||
const KEY = 38;
|
const KEY = 38;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script defines a function that acts as a method.
|
//! This script defines a function that acts as a method.
|
||||||
|
|
||||||
// Use 'this' to refer to the object of a method call
|
// Use 'this' to refer to the object of a method call
|
||||||
fn action(x, y) {
|
fn action(x, y) {
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs if statements.
|
//! This script runs if statements.
|
||||||
|
|
||||||
let a = 42;
|
let a = 42;
|
||||||
let b = 123;
|
let b = 123;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs an if expression.
|
//! This script runs an if expression.
|
||||||
|
|
||||||
let a = 42;
|
let a = 42;
|
||||||
let b = 123;
|
let b = 123;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs an infinite loop, ending it with a break statement.
|
//! This script runs an infinite loop, ending it with a break statement.
|
||||||
|
|
||||||
let x = 10;
|
let x = 10;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script simulates multi-dimensional matrix calculations.
|
//! This script simulates multi-dimensional matrix calculations.
|
||||||
|
|
||||||
const SIZE = 50;
|
const SIZE = 50;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script imports an external script as a module.
|
//! This script imports an external script as a module.
|
||||||
|
|
||||||
import "loop" as x;
|
import "loop" as x;
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script simulates object-oriented programming (OOP) techniques using closures.
|
//! This script simulates object-oriented programming (OOP) techniques using closures.
|
||||||
|
|
||||||
// External variable that will be captured.
|
// External variable that will be captured.
|
||||||
let last_value = ();
|
let last_value = ();
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs a single expression.
|
//! This script runs a single expression.
|
||||||
|
|
||||||
print("The result should be 46:");
|
print("The result should be 46:");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs a complex expression.
|
//! This script runs a complex expression.
|
||||||
|
|
||||||
print("The result should be 182:");
|
print("The result should be 182:");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs a complex expression.
|
//! This script runs a complex expression.
|
||||||
|
|
||||||
print("The result should be 230:");
|
print("The result should be 230:");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script uses the Sieve of Eratosthenes to calculate prime numbers.
|
//! This script uses the Sieve of Eratosthenes to calculate prime numbers.
|
||||||
|
|
||||||
let now = timestamp();
|
let now = timestamp();
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs 1 million iterations to test the speed of the scripting engine.
|
//! This script runs 1 million iterations to test the speed of the scripting engine.
|
||||||
|
|
||||||
let now = timestamp();
|
let now = timestamp();
|
||||||
let x = 1_000_000;
|
let x = 1_000_000;
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script tests string operations.
|
//! This script tests string operations.
|
||||||
|
|
||||||
print("hello");
|
print("hello");
|
||||||
print("this\nis \\ nice"); // escape sequences
|
print("this\nis \\ nice"); // escape sequences
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script tests object maps and strings.
|
//! This script tests object maps and strings.
|
||||||
|
|
||||||
print("Ready... Go!");
|
print("Ready... Go!");
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs a switch statement in a for-loop.
|
//! This script runs a switch statement in a for-loop.
|
||||||
|
|
||||||
let arr = [42, 123.456, "hello", true, "hey", 'x', 999, 1, 2, 3, 4];
|
let arr = [42, 123.456, "hello", true, "hey", 'x', 999, 1, 2, 3, 4];
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
// This script runs a while loop.
|
//! This script runs a while loop.
|
||||||
|
|
||||||
let x = 10;
|
let x = 10;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user