Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

how to recurse a function

#Simply recursive function that counts from 0 to 10
def count(n): #function named count
	
    if n <= 10: #base case.This is to put a limit to the amount of recursions
    	print(n)
    	count(n+1) # this is a "recursive call" to the function count
      
count(0) # this is where the function is first called.
 
PREVIOUS NEXT
Tagged: #recurse #function
ADD COMMENT
Topic
Name
8+7 =