I have very simple question, lets say i have function that generates random integer from chosen range, without generating zero. It goes like this:
customfunction=function(minv,maxv){
value=floor(runif(1,min=minv,max=maxv))
repeat {
if (value<0){break}
else if(value>0){break}
else {value=floor(runif(1,min=minv,max=maxv))}
}
print(value)
}
Very simple. What i want to do is to make the part that restricts my function from generating zero to be just one sentence for example zero_restriction, in MY HEAD it would look like this:
customfunction=function(minv,maxv){
value=floor(runif(1,min=minv,max=maxv))
zero_restriction
print(value)
}
Is this possible? Or is it too much of workaround to be worth? The point is I am going to have couple of functions each with certain restrictions, so i thought simplifying them to one word would be more convenient.