02-28-2021, 05:31 PM
(02-27-2021, 12:15 PM)RandomiserUsr Wrote: If you compile the following codeĀ
FUNCTION A(text as STRING)
Print B("Test")
RETURN 0
END FUNCTION
FUNCTION C(text as STRING)
Print B("Test")
RETURN 0
END FUNCTION
FUNCTION B(text as STRING)
Print ("Test")
RETURN 0
END FUNCTION
you will get
inputmud.bas:137: error: 'B' is neither an array nor a function.
inputmud.bas:135: warning: [W150] Parameter 'text' is never used
inputmud.bas:144: warning: [W100] Using default implicit type 'float' for 'C'
inputmud.bas:144: error: 'B' is neither an array nor a function.
inputmud.bas:143: warning: [W150] Parameter 'text' is never used
inputmud.bas:149: warning: [W100] Using default implicit type 'float' for 'B'
inputmud.bas:148: warning: [W150] Parameter 'text' is never used
but moving function B above like below compiles okay
So I guess it's a TOP Down design where the functions in the same .BAS should be ordered
FUNCTION B(text as STRING)
Print ("Test")
RETURN 0
END FUNCTION
FUNCTION A(text as STRING)
Print B("Test")
RETURN 0
END FUNCTION
FUNCTION C(text as STRING)
Print B("Test")
RETURN 0
END FUNCTION
Great tool
Thanks
Ken
That is. If you want to reference a function before being declare, use DECLARE:
https://zxbasic.readthedocs.io/en/docs/declare/