I can't get the lines that are commented to work. I can use some help here. Also, any recommendations on how to get the updated balance to stay within the function? This way the second time you play the game, you have a different balance than 1,000 depending on how much you bet on the first game. I do not know how to keep the updated balance in a loop for the next time you run the function. Thanks!
playCraps <- function(betSize){
balance <- 1000
errors<- character(0)
if(betSize > balance){
errors <- paste("Please enter a bet size within your current balance", sep="\n")
}
# if(!is.numeric(betSize)){
# errors <- paste("Please enter a number", sep="\n")
# }
# if(!is.integer(betSize)){
# errors <- paste("Please enter a whole number", sep="\n")
# }
if(length(errors) > 0){
stop(errors)
}