Checked: FNXBasic works with recursive functions !

In this category you can exchange your programming questions and solutions.
Post Reply
Fazer
Posts: 30
Joined: Tue Apr 29, 2008 12:43 pm

Checked: FNXBasic works with recursive functions !

Post: # 211Post Fazer
Tue May 06, 2008 8:57 am

I was interested if FNXBasic is working with recursive functions.

So I`have written a small program to calculate the faculty of numbers within a recursive function.

(For those people who don`t know that:
? A recursive function is a function that calls itself!)

`========================================
`begin of code
? ?Dim wert as LONG

? ?wert = FAC(3)
? ?showmessage "The result is: " + str$(wert)

? ? FUNCTION FAC(value AS LONG) AS LONG
? ? ? ? result = 1
? ? ?? ?IF value > 1 THEN result = value * ?FAC(value - 1)
? ? END FUNCTION
`end of code?
`========================================


I think this information should also be included in the help !
Because it is important: you can simplify your code.
To calculate the faculty with a nonrecursive function you need much more lines!

I hope my posts will improve the traffic in this sleepy forum a little bit! ? ;)

Hi to all
Fazer

Post Reply