oops i found it.

i had to do this

  IncrementVariable2(ByRef Number1)


On Mon, 2011-01-03 at 12:35 +0100, Benoît Minisini wrote:
> > Hi,
> > 
> > i made an example for BYREF but it is not working
> > 
> > --------------------------------
> > ' Gambas class file
> > 
> > Public Sub Form_Open()
> > 
> >   Dim Number1 As Integer
> > 
> >   Number1 = 10
> > 
> >   IncrementVariable1(Number1)
> > 
> >   Print Number1
> > 
> >   IncrementVariable2(Number1)
> > 
> >   Print Number1
> > 
> > End
> > 
> > Private Sub IncrementVariable1(Num1 As Integer)
> >   'ByVal sub
> >   Num1 = Num1 + 1
> > 
> > End
> > 
> > Private Sub IncrementVariable2(ByRef Num2 As Integer)
> >   'ByRef sub
> > 
> >   Num2 = Num2 + 1
> > 
> > End
> > --------------------------------
> > result:
> > 10
> > 10 <- this shouldn't be 11?
> 
> Did you read the documentation on ByRef ?
> 

-- 
Regards,
Demosthenes Koptsis.


------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and, 
should the need arise, upgrade to a full multi-node Oracle RAC database 
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
_______________________________________________
Gambas-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/gambas-user

Reply via email to