Skip to content

Instantly share code, notes, and snippets.

@TheMuellenator
Last active January 2, 2025 15:54
Show Gist options
  • Select an option

  • Save TheMuellenator/69efa8bb847c58c6bc01a82d3f30fd34 to your computer and use it in GitHub Desktop.

Select an option

Save TheMuellenator/69efa8bb847c58c6bc01a82d3f30fd34 to your computer and use it in GitHub Desktop.
iOS repl.it - Variables Challenge Solution
var a = 5
var b = 8
var c = a
a = b
b = c
print("a: \(a)")
print("b: \(b)")
@ziashah

ziashah commented Jul 1, 2024

Copy link
Copy Markdown

var a = 5
var b = 7

a = a + b // 12
b = a - b // 12 - 7 = 5
a = a - b // 12 - 5 = 7

print("a: (a)")
print("b: (b)")

@Zuanid-Sutlan

Copy link
Copy Markdown

var a = 5
var b = 8

print("the value of a is (a)")
print("the valu of b is (b)")

var temp = a
a = b
b = temp

print("the value of a is (a)")
print("the valu of b is (b)")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment