[futurebasic] Re: [FB] Still can't find the bug in END FN... I know it's a bug in my code though

Message: < previous - next > : Reply : Subscribe : Cleanse
Home   : July 2009 : Group Archive : Group : All Groups

From: Stu Cram <stu@...>
Date: Thu, 23 Jul 2009 20:39:49 -0600
On 23-Jul-09, at 6:45 PM, Brian Heibert wrote:

> Here's the whole program source
> I found 1 error on my part
> originally the FN was called DoAddition
> now it's called ProgramAddition
> I think I fixed it in the whole source now
> <snip>
___________________________________

At least 2 replies yesterday indicated there is no need to use  
PASSTHROUGH.
That's only needed for complex C code but not in this case just to add  
2 numbers!
Rewrite your functions to keep them pure FutureBASIC.  KISS rule.

Ditto for the TOOLBOX references to add, subrtract, etc.   Omit them
KISS rule.

And finally, one more KISS option.... re your main menu....
Why use function keys when you could use the letters A, S, M and D
which might be more easily associated with Add, Subtract, Multiply and  
Divide?
Your decisions wll then be easier to write and understand too,

	DIM 1 inputChar$		' define a one byte string

	inputChar$ = ""
	DO 					' read in one typed key  (Instead of your
		inputChar$ = INKEY$	
	UNTIL LEN( inputChar$ ) = 1

	SELECT inputChar$	' replacement for your FN CheckForKeys
		CASE "A:  :  FN DoAddition
		CASE "S"  :  FN doSubtraction
		' etc
		CASE "X"  :  END
		CASE ELSE  ' do nothing or maybe beep once
	END SELECT

HTH  - remember to simplify your program and test / add one idea/ 
feature at a time.