initial commit, 4.5 stable
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
Some checks failed
🔗 GHA / 📊 Static checks (push) Has been cancelled
🔗 GHA / 🤖 Android (push) Has been cancelled
🔗 GHA / 🍏 iOS (push) Has been cancelled
🔗 GHA / 🐧 Linux (push) Has been cancelled
🔗 GHA / 🍎 macOS (push) Has been cancelled
🔗 GHA / 🏁 Windows (push) Has been cancelled
🔗 GHA / 🌐 Web (push) Has been cancelled
This commit is contained in:
19
modules/gdscript/tests/scripts/runtime/features/recursion.gd
Normal file
19
modules/gdscript/tests/scripts/runtime/features/recursion.gd
Normal file
@@ -0,0 +1,19 @@
|
||||
func is_prime(number: int, divisor: int = 2) -> bool:
|
||||
print(divisor)
|
||||
if number <= 2:
|
||||
return (number == 2)
|
||||
elif number % divisor == 0:
|
||||
return false
|
||||
elif divisor * divisor > number:
|
||||
return true
|
||||
|
||||
return is_prime(number, divisor + 1)
|
||||
|
||||
func test():
|
||||
# Not a prime number.
|
||||
print(is_prime(989))
|
||||
|
||||
print()
|
||||
|
||||
# Largest prime number below 10000.
|
||||
print(is_prime(9973))
|
Reference in New Issue
Block a user