MsgBox statement vs function

There are 2 (almost identical) pages describing MsgBox :

Since there’s also InputBox Function
I’d tend to think the MsgBox statement is obsolete …
But who knows …
any idea, clue ?

1 Like

Just drop the statement page. We don’t handle it in any special way, it’s just SbRtl_MsgBox function.

1 Like

thanks.

looks like the tip of an iceberg ?
croos-over from VBA ?

Mid is a different beast. Mid function returns a value. Mid statement replaces in-place.

1 Like

There is a tiny difference between Mid-function ( it returns the part-string described by start and optional lenght )
and the Mid-Statement ( it changes the first Argument according to the defined start , length, replace-string )

sub main
	original_text = "This is the original Text"

	msgbox mid( original_text , 13, 8) 'function-call shows: »original«'
	msgbox original_text 'shows: »This is the original Text«'
	mid( original_text, 13, 8, "new" ) 'statement'
	msgbox original_text 'shows: »This is the new Text«'
end sub

Also relevant for Excel. :slight_smile:

FTR: we have three “statement functions” in Basic: besides Mid, they are Date and Time. This is specified in basic/source/runtime/stdobj.cxx: see where LFUNCTION_ is used there.

But for these two latter, statement behavior is not implemented: see e.g. Time returning error when trying to write to it.

Aha, there’s also MkDir statement, which is not decorated as such in the mentioned file - will fix that.

1 Like

will it be? should it be?
a bugzilla on this ?

No idea; I have no intention working on that - would you expect someone running across some fact in the code to necessarily have knowledge if this is really needed to someone? :wink:

thanks.
looks much more explanatory than the example in the help page.
do you mind if I put it in there?

1 Like

of course take it!