Skip to content

Instantly share code, notes, and snippets.

@sahilseth
Created January 24, 2018 23:16
Show Gist options
  • Save sahilseth/dedda70f795d8ffff56f718f43c416e3 to your computer and use it in GitHub Desktop.
Save sahilseth/dedda70f795d8ffff56f718f43c416e3 to your computer and use it in GitHub Desktop.
yesno <- function(...) {
yeses <- c("Yes", "Definitely", "For sure", "Yup", "Yeah",
"I agree", "Absolutely")
nos <- c("No way", "Not yet", "I forget", "No", "Nope", "Uhhhh... Maybe?")
qs <- c(sample(yeses, 1), sample(nos, 2))
rand <- sample(length(qs))
cat(paste0(..., collapse = ""))
menu(qs[rand]) == which(rand == 1)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment