You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
13 lines
328 B
R
13 lines
328 B
R
5 years ago
|
my.name <- readline(prompt="Enter name: ")
|
||
|
my.age <- readline(prompt="Enter age: ")
|
||
|
|
||
|
# convert character into integer
|
||
|
my.age <- as.integer(my.age)
|
||
|
|
||
|
print(paste("Hi,", my.name, "next year you will be", my.age+1, "years old."))
|
||
|
|
||
|
Output
|
||
|
|
||
|
Enter name: Mary
|
||
|
Enter age: 17
|
||
|
[1] "Hi, Mary next year you will be 18 years old."
|