I want to do it, but so far all I have is:
print("Will you go out with me?")
I want the code to work so that one can answer yes/no and if answer is yes then a message would return saying like the time, place, etc.
The person I am asking is an R guru so it would mean a lot to them ~~(:
Would love some help. Trying to get that date!
Put the following into a file and then ask your friend to source the file.
r <- readline("Will you go out with me? (respond 'yes' or 'no'): ")
if(grepl("[Yy]es", r)) {
cat("Date: 3/10/2018", "Time: 7pm", "Place: McDonalds", sep = "\n")
} else {
cat("Too bad, I'm a catch.")
}
Now your friend sources the file and BOOM, date!
> source('~/.active-rstudio-document')
Will you go out with me?: yes
Date: 3/10/2018
Time: 7pm
Place: McDonalds
... or BOOM, rejected!
> source('~/.active-rstudio-document')
Will you go out with me?: no
Too bad, I'm a catch.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With