Ask Your Question

Argument is not optional

asked 2019-05-01 23:00:22 +0200

Bo B gravatar image

updated 2019-05-02 01:53:13 +0200

erAck gravatar image

I keep getting the error "Argument is not optional" when running the following

REM  *****  BASIC  *****

Sub Main
    Call nRight(5)
End Sub

Sub nRight(n as Integer)
    print "n = ",n
End Sub

What am I doing wrong?


Bo B

edit retag flag offensive close merge delete


When you run, take care what you run: i.e., where the cursor is.

Mike Kaganski gravatar imageMike Kaganski ( 2019-05-01 23:04:17 +0200 )edit

AOO Basic debugger always runs the first Sub / Function of the module if you start with a step. Recent LibO Basic debugger starts the routine where the cursor is in.

Lupp gravatar imageLupp ( 2019-05-01 23:11:43 +0200 )edit

For readers' convenience I just formatted the code as code instead of flow text by properly indenting all with 4 spaces.

erAck gravatar imageerAck ( 2019-05-02 01:56:19 +0200 )edit

1 Answer

Sort by » oldest newest most voted

answered 2019-06-04 16:37:45 +0200

You will get that error if your insertion point is within Sub nRight when you run the macro.

To avoid the error, position your insertion point within Sub Main before you run the macro, e.g. by clicking within the line 'Call nRight(5)'.

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower


Asked: 2019-05-01 23:00:22 +0200

Seen: 685 times

Last updated: Jun 04 '19