mercredi 30 novembre 2016

How do I end an R program?

I am very new to R programming. I understand it is more or less meant to be a statistics and number language, but I was thinking outside the box and wanted to make a password program. Where the user is asked for a password and if correct they can move on. If not, the program closes. Here is my code

print("Hello!")
   my.name <- readline(prompt="What is your name? ")
print(paste("Hello,", my.name))
x <- readline(prompt="What would be the password? ")
  if (x == 123) {
print("Correct!")
  } else {
print("Incorrect!")
}

I would like to know what to put in my ELSE spot to end the program. Thanks :D

Aucun commentaire:

Enregistrer un commentaire