I think the easiest way is to put readline code as an argument. The force commands force this code to be evaluated at this point in the function. I don't think they are necessary, but depending on what else the function does, you may want it to ask j and k first, and not later; otherwise the code will be evaluated when it first needs to know that j and k .
Input <- function(j = readline(prompt="Enter Input 1: "), k = readline(prompt="Enter Input 2: ")) { force(j) force(k) if ((j=="<string here>") && (k=="<string here>")) { .... } }
Aaron
source share