Is it one error with line?

Is it one error with line? - Сообщения

#1 Опубликовано: 13.09.2024 11:57:22
Valery Ochkov

Valery Ochkov

55 сообщений из 633 понравились пользователям.

Группа: User

Factorial-2.sm (7 КиБ) скачан 17 раз(а).
Factorial-Err.png
#2 Опубликовано: 13.09.2024 14:14:18
Davide Carpi

Davide Carpi

1415 сообщений из 2872 понравились пользователям.

Группа: Moderator

You can guess by the error message (function is not defined).
The key is that you are using a recursive pattern, and in the first case the internal Factorial() can't be calculated because the context in which the function runs is the "top level" (the canvas), where Factorial(1) doesn't yet exists (it will exists for the next region on the closest canvas pixel on the right side).
The line() on the RHS of a define operator (colon) creates a sub-level that inherit everything from the higher level(s) including the function whom the line() belongs, and that's why the second function works as you expect.
The bottom examples are unrelated because are not recursive.

Hope it helps.
If you like my plugins please consider to support the program buying a license; for personal contributions to me: paypal.me/dcprojects
  • Новые сообщения Новые сообщения
  • Нет новых сообщений Нет новых сообщений