Step - option

option ยท category: Branches and loops

Adds a branch to choose()/branch() for a key (a value, Pick.none, Pick.any), or the onCreate/onMatch map of merge_v()/merge_e().

Forms

option(arg1: any, arg2: any)
option(arg1: Merge, arg2: any, arg3: Cardinality)

Example

g.v().has_label("person").choose(__.values("age")).option(29, __.constant("marko's age")).option(Pick.none, __.constant("other")).to_list()   // ["marko's age", "other", "other", "other"]

See also