Macro Swap
macro swap(a, b)
temp = {{a}}
{{a}} = {{b}}
{{b}} = temp
end
temp = "z"
x = "x"
y = "y"
swap(x, y)
p! x
p! y
p! temp
x # => "y"
y # => "x"
temp # => "x"
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
macro swap(a, b)
temp = {{a}}
{{a}} = {{b}}
{{b}} = temp
end
temp = "z"
x = "x"
y = "y"
swap(x, y)
p! x
p! y
p! temp
x # => "y"
y # => "x"
temp # => "x"