27 lines
387 B
Plaintext
27 lines
387 B
Plaintext
' FB 1.05.0
|
|
#Macro Declare_Swap(T)
|
|
Sub Swap_##T(ByRef t1 As T, ByRef t2 As T)
|
|
Dim temp As T = t2
|
|
t2 = t1
|
|
t1 = temp
|
|
End Sub
|
|
#EndMacro
|
|
|
|
Dim As Integer i, j
|
|
i = 1 : j = 2
|
|
|
|
Declare_Swap(Integer) ' expands the macro
|
|
Swap_Integer(i, j)
|
|
Print i, j
|
|
|
|
Dim As String s, t
|
|
s = "Hello" : t = "World"
|
|
|
|
Declare_Swap(String)
|
|
Swap_String(s, t)
|
|
Print s, t
|
|
|
|
Print
|
|
Print "Press any key to exit"
|
|
Sleep
|