[Gambas-user] ByRef
Emil Tchekov
emil at ...1913...
Tue Sep 2 12:06:09 CEST 2008
Forgot to gave you example (VB)
sub main()
dim a as integer
a=1
debug.print a, pr1(a)
debug.print a, pr2(a)
debug.print a
end sub
private sub pr1(byval a)
a=2
return a
end sub
private sub pr2(byref a)
a=2
return a
end sub
result will be as follows
1 2
1* 2
2 (!)
*As you can see on the first sub the var a is local to your sub, it was
changed (returns 2), but the passed a has stil value 1
(!) in the second procedure the passed var a was changed! (the a that was
defined in the sub main!)
-----Ursprungliche Nachricht-----
Von: gambas-user-bounces at lists.sourceforge.net
[mailto:gambas-user-bounces at lists.sourceforge.net]Im Auftrag von
gambas at ...1938...
Gesendet: Dienstag, 2. September 2008 11:28
An: mailing list for gambas users
Betreff: [Gambas-user] ByRef
Hello List!
I've switched to development version 3.0 and I'm trying to get rid of this
ByRef thing. I wonder, if someone could explane the syntax to me!
Thanks in advance!!
Greetz
Stevie
-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great
prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
Gambas-user mailing list
Gambas-user at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/gambas-user
More information about the User
mailing list