02-02-2025, 09:23 PM
Hi all,
New user here, thanks for providing this forum & please bear with me...
I am trying to learn how to build my own external library of functions and/or subroutines.
Here is what I have right now:
Error in message window: "Statement cannot be placed between SUB/FUNCTIONs on current line"
What I've tried so far:
The changes I made have changed the error message to say different things, but I haven't once been able to run the program after guessing which changes were required.
Any help is appreciated! Version I'm using is 4.0, Manjaro Linux. I am used to programming in other languages like PHP, Perl, Raku, Object Pascal, and others, but fairly new to this kind of library-call feature in basic dialects.
New user here, thanks for providing this forum & please bear with me...
I am trying to learn how to build my own external library of functions and/or subroutines.
Here is what I have right now:
Code: (Select All)
'$Include: 'mylib.bas'
AddNumbers
Error in message window: "Statement cannot be placed between SUB/FUNCTIONs on current line"
Code: (Select All)
' mylib.bas
' Add two numbers. Or don't.
Sub AddNumbers (a, b)
'AddNumbersResult = a + b
'Print "Adding: "; _ToStr$(a); " + "; _ToStr$(b); " = "; _ToStr$(AddNumbersResult)
Print "Hello world."
End Sub
What I've tried so far:
- Adding, removing parens to/from the call to AddNumbers
- Adding, removing parameters to/from the call to AddNumbers - AddNumbers(2,3)
- Adding, removing "as Integer" to/from Sub/function parameters
- Using variables to call the sub/function, rather than literal integers
- Removing spaces between sub/function name and parens
- Converting the sub to function and back again
- Moving the include directive from top to bottom
- Adding a declaration of the sub to the library file
- Changing all function/sub logic to simply "Hello world." just in case
- Browsing the wiki entries for sub, function, include, etc.
The changes I made have changed the error message to say different things, but I haven't once been able to run the program after guessing which changes were required.
Any help is appreciated! Version I'm using is 4.0, Manjaro Linux. I am used to programming in other languages like PHP, Perl, Raku, Object Pascal, and others, but fairly new to this kind of library-call feature in basic dialects.