[Gambas-user] Gambas3, Byref is not working

Demosthenes Koptsis demosthenesk at ...626...
Mon Jan 3 12:33:45 CET 2011


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?


-- 
Regards,
Demosthenes Koptsis.





More information about the User mailing list