我习惯于 Python,以下代码可以正常工作,没有任何例外。但是,当我尝试运行命令时,我在 R 中收到以下错误。
a <- readline(prompt="Give a num between 1-10: ")
b <- readline(prompt="Give another between 11-20: ")
if((1 <= a <= 10) & (11 <= b <= 20)) {
a <- a
b <- b
} else {
a <- readline(prompt="Give a correct num between 1-10: ")
b <- readline(prompt="Give a correct num between 11-20: ")
}
错误: