Advertisement
hectic101

Swapping Values (ByRef)

Apr 12th, 2015
1,130
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Sub Main
  2.     Dim x as Integer
  3.     Dim y as Integer
  4.  
  5.     x = 10
  6.     y = 57
  7.    
  8.     Swap x, y
  9.     MsgBox " x = " & x & "y =" & y
  10. End Sub
  11.  
  12. Sub swap (ByRef a As integer, ByRef b As Integer)
  13.     Dim temp As Integer
  14.  
  15.     tmp = a
  16.     a = b
  17.     b = temp
  18.  
  19. End Sub
Advertisement
RAW Paste Data Copied
Advertisement