Error checking an inputed value

前端 未结 1 604
我在风中等你
我在风中等你 2021-01-29 13:59

I\'ve got a function that uses readline to ask people to enter in data. But I\'m at a loss as to the best method to insure that the data entered meet my criteria. I\'m figuring

相关标签:
1条回答
  • 2021-01-29 14:38

    In R the boolean types TRUE and FALSE can also be represented by T and F. So first off try changing the variables that you have named T to something sensible... like x maybe???

    Secondly, in your typeof(x) argument, you called the variable T, so that won't work. In addition there were no quotes around numeric. Try if(!(is.numeric(x)))

    Thirdly, your variables are inconsistently named, V and V, and then V1 and V2. Aside from hard to read, it also just won't work.

    Lastly, your return statement needs a second closing parenthesis, the function code block needs a closing curly brace.

    0 讨论(0)
提交回复
热议问题