?= { => , _ => }

Match

Match: `?= { => }`

Variable

/*
 * Check if x matches any of the cases below.
 * `_` means default case.
 */

x ?= {
    1 => { ... };
    2 => { ... };
    3 => { ... };
    _  => { ... };
}

Function

/*
 * `#?` represents one (and only one) argument of the function `endswith`.
 * `#? ' will be assigned with ".txt" ".csv" and ".json" in sequence.
 * Check if file_name.endswith(#?) is true for all cases below.
 * `_` means default case.
 */

file_name.endswith(#?) ?= {
    ".txt" => { ... };
    ".csv" => { ... };
    ".json" => { ... };
    _  => { ... };
}

Last updated