New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip branch with option=0 #70

Closed
Enchufa2 opened this Issue Jul 22, 2016 · 0 comments

Comments

Projects
None yet
1 participant
@Enchufa2
Member

Enchufa2 commented Jul 22, 2016

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.

@Enchufa2 Enchufa2 added this to the v3.4.0 milestone Jul 22, 2016

@Enchufa2 Enchufa2 closed this in a5c631c Jul 26, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment