3.52. kink/param/OPT_PARAM

Provides opt_param data type.

3.52.1. type opt_param

An opt_param is a param which can consume 0 or 1 argument.

See Vec.op_store for handling of params.

Usually, an opt_param is provided by Varref.opt method.

Example:

[:A :B :C.opt] <- [1 2 3]
stdout.print_line(C.repr) # => [3]

[:D :E :F.opt] <- [4 5]
stdout.print_line(F.repr) # => []

Opt_param.pass_arg(Arg)

Opt_param.pass_arg consumes Arg as a single argument.

Opt_param.pass_nothing

Opt_param.pass_nothing consumes no argument.

3.52.2. OPT_PARAM.opt_param?(Val)

OPT_PARAM.opt_param? returns whether the Val is an opt_param.