Recursion vs Self-Reference – What is the Difference?

recursionterminology

The wikipedia articles are too advanced for me to understand, could someone give me a simple explanation please?

Best Answer

The context of the two terms is generally different.

Self referencing is in the context of data -- you have a data type that contains a reference to something of the same type.

Recursive is in the context of code -- you have a function or procedure that calls itself.

Example:

def factorial(n):
if n == 1:
    return 1
else:
    return n * factorial(n-1)