+ 2
What is the recursion in the programming?
I see that for some ordering algorithms in data structures they have the characteristic of being recursive functions, some example or short definition?
4 Respostas
+ 5
A brief overview of the concept:
https://www.sololearn.com/discuss/307407/?ref=app
+ 4
You can use the search feature in the Learn section for keyword "recursion", here's one of the results:
https://www.sololearn.com/learn/3797/?ref=app
+ 2
Example of Recursion for user input
// a standard function used in recursive manner to get input with no loops
function getinput() {
function triple(x) {
return x * 3;
}
let inputnum = prompt("give me a number and I will multiply by 3");
if (isNaN(Number(inputnum))) {
console.log("please type in a number");
getinput();
} else {
console.log(triple(inputnum));
}
}
getinput();
+ 1
Recursive function is a function that calls itself.