4.73. kink/param/OPT_PARAM

Provides opt_param data type.

4.73.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) # => []

4.73.1.1. Opt_param.pass_arg(Arg)

Opt_param.pass_arg consumes Arg as a single argument.

4.73.1.2. Opt_param.pass_nothing

Opt_param.pass_nothing consumes no argument.

4.73.2. OPT_PARAM.is?(Val)

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