Skip to content

Skip branch with option=0 #70

Closed
Closed
@Enchufa2

Description

@Enchufa2

Use case: set an optional path and be able to skip it. Solution: skip a branch and continue to the next activity if the option function returns 0. So

t <- create_trajectory() %>%
  branch(function() 0, F, create_trajectory() %>%
           timeout(function() { print("optional"); 0 })) %>%
  timeout(function() { print("main"); 0 })

simmer() %>%
  add_generator("dummy", t, at(0)) %>%
  run()
#> Error: Branch: index out of range

should print main instead of the error.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions