-5
Hello, I’m trying to do this program there in rstudio, but when I select everything to run, it gives this error. If I put it to run the first line and then the rest, then it runs the program straight. Maybe it’s something stupid that I’m not aware of. And neither this and other programs you do in rstudio.
To follow my code:
id = as.integer(readline(prompt = "Escreva sua idade: "))
if(id >= 0 && id < 18){
print("você é uma criança")
}
else if(id >= 18 && id <= 50){
print("você é adulto")
}
else print("você é um adulto experiente")
Without a reproducible example It’s hard to help, @Lenesson.
– neves
You can see on the top right of Rstudio that the id is valued
NA
(NA_integer_
). This causes the error in question. Here’s how you’re setting this variable– Tomás Barcellos
It seems to have relation to all two things right, without giving type what a user would type in age.
– Tomás Barcellos