stop() फंक्शन का उपयोग
stop() फंक्शन का उपयोग यह बताने के लिए किया जाता है कि कुछ गड़बड़ है।
यह अभ्यास पाठ्यक्रम का हिस्सा है
Defensive R Programming
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# Stop the execution if ages are negative
mean_age <- function(ages) {
if(any(ages < ___)) {
___("You have negative ages!")
}
m <- mean(ages)
return(m)
}