Definitionپێناسە
In , the simple case that is answered directly, without calling the function again, such as 'fact(0) is 1'. It stops the calls; without it they never end and Python stops with RecursionError.
لە ، ئەو حاڵەتە سادەیەیە کە ڕاستەوخۆ وەڵام دەدرێتەوە بەبێ بانگکردنەوەی ، وەک «fact(0) دەکاتە 1». بانگکردنەکان دەوەستێنێت؛ بەبێ ئەو کۆتاییان نایەت و Python بە RecursionError دەوەستێت.
Exampleنموونە
n == 0 is the base case; n * fact(n - 1) is the recursive case.
n == 0 حاڵەتی بنچینەیە؛ n * fact(n - 1) .
def fact(n):
if n == 0: # base case
return 1
return n * fact(n - 1) # recursive case
print(fact(3)) # 6Other Kurdish renderings in useوەرگێڕانە کوردییەکانی تر
حاڵەتی بنچینەکە، حاڵەتێکی بنچینە
Note on the Kurdish termتێبینی دەربارەی زاراوە کوردییەکە
Descriptive coinage: حاڵەت (case) + بنچینە (base, as in Barzinji's «زمانی بنچینەیی» for base language). حاڵەتی بنەڕەتی is avoided because the registry lists it as an alternative of default-case. Proposed.
Related termsزاراوە پەیوەندیدارەکان
Videosڤیدیۆکان
A function that calls itself: one walk written with a loop and with recursion, the base case that stops it, and why loops are faster.
کە بانگی خۆی دەکاتەوە: هەمان ڕۆیشتن جارێک بە و جارێک بە دەنووسرێت، کە ڕایدەگرێت و بۆچی خێراترن.