Quote Originally Posted by SteveB View Post
Another recursive method. However this time it uses the unique feature of Variable Rollover. Also, if nothing is found at the end of checking all possible values for a WORD, the outcome must be Zero.

Code:
TestNumber as word
TestVal as word

For TestVal = 65534 to 2 step -2
	If (TestNumber + TestVal)= 0 Then
		LCDOUT "Even"
		EndProgram
	Else
		If (TestNumber + TestVal) + 1 = 0 then
			LCDOUT "Odd"
			EndProgram
		Else
	Endif
Next TestVal
	LCDOUT "Zero"
EndProgram:
end
I don't consider that to be recursive. To be recursive means to have a procedure (method in Java's case) -- that repeatedly calls itself until the operation is complete.

Kinda like getting a pie that you need to cut up into (n) pieces. Instead of cutting out each piece you cut the whole thing repeadedly until you have (n) pieces.

Trent Jackson