Wiki improvements

Forum for discussion about the documentation project.
Post Reply
SARG
Posts: 1675
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

As default value of parameters in procedures it's possible to use a variable (only a shared one).

I didn't see this information in the help so maybe it would be usefull to add it.

Code: Select all

dim shared as integer vshared
dim        as integer vlocal=15

vshared=19

sub test1(aa as integer=vshared)
	print aa
End Sub

'sub test2(aa as integer=vlocal)   ''not allowed
	'print aa
'End Sub

test1

vshared=17
test1

sleep
fxm
Moderator
Posts: 11921
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

This is only a special case of variables which, to be implicitly accessible (not passed as a parameter) from a procedure, must therefore be shared.
SARG
Posts: 1675
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

My purpose is just to complete the information about default value as nothing says that a variable can be used (in help it's written : value).
And I don't remember if I already did or saw a such use.
fxm
Moderator
Posts: 11921
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

OK.
I propose to complement the 'Parameters' paragraph of the SUB/FUNCTION keywords ('default_value' line).
fxm
Moderator
Posts: 11921
Joined: Apr 22, 2009 12:46
Location: Paris suburbs, FRANCE

Re: Wiki improvements

Post by fxm »

Done:
- KeyPgSub → fxm [default parameter initializer can be a literal, or a constant, or a shared variable]
- KeyPgFunction → fxm [default parameter initializer can be a literal, or a constant, or a shared variable]
SARG
Posts: 1675
Joined: May 27, 2005 7:15
Location: FRANCE

Re: Wiki improvements

Post by SARG »

Thanks.
Post Reply