Ceci est une ancienne révision du document !
La récursivité en algorithmique est le fait qu'un algorithme contienne un ou plusieurs appels à lui-même.
def fctA(): print ("Début fonction fctA") i=0 while i<5: print(f"fctA {i}") i = i + 1 print ("Fin fonction fctA") def fctB(): print ("Début fonction fctB") i=0 while i<5: if i==3: fctA() print("Retour à la fonction fctB") print(f"fctB {i}") i = i + 1 print ("Fin fonction fctB") fctB()
La fonction fctB appelle la fonction fctA, lors de son exécution, la fonction fctA va interrompre la fonction fctB.