Skip to content

Commit

Permalink
added error for non letters
Browse files Browse the repository at this point in the history
  • Loading branch information
tyler rinker committed Jul 24, 2012
1 parent ffc74ed commit 5b1367c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/hangman.R
Expand Up @@ -84,6 +84,9 @@ function() {
if (y %in% c(right, wrong)) {
stop(paste0("You've already guessed ", y))
}
if (!y %in% letters) {
stop(paste0(y, " is not a letter"))
}
if (y %in% x) {
right <<- c(right, y)
win1 <<- sum(win1, sum(x %in% y))
Expand Down

0 comments on commit 5b1367c

Please sign in to comment.