Skip to content

Instantly share code, notes, and snippets.

@amaseda
Created July 16, 2015 15:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save amaseda/35a62128d8795e045d49 to your computer and use it in GitHub Desktop.
Save amaseda/35a62128d8795e045d49 to your computer and use it in GitHub Desktop.
Variable Assignment Exercise
1.
a = 5
a = 6
What is a?
2.
a = 5
a + 2
What is a?
3.
a = 5
b = 7
a = b + 2
What is b?
4.
a = 5
b = 10
c = a + b
What is c?
5.
a = 5
a = a + 2
What is a?
6.
a = 5
b = 10
c = a + b * 2
What is c?
7.
a = 5
b = 10
c = a
a = b
What is c? What is a?
8.
a = 5
b = 10
a = b
b = a
What is b?
9.
a = 5
b = 10
a = b
b = a + b
What is b?
10.
a = "a"
b = "b"
b.upcase!
a = b
What is a?
11.
a = "a"
b = "b"
a.upcase!
b = a
a.downcase!
What is a? What is b?
12.
a = "a"
b = "b"
b.upcase!
a = b
b.downcase!
c = a + b
What is c?
13.
a = 10
b = "b"
c = "c"
a = a + b.to_i
b.upcase!
b = b + c
d = a.to_s + b + c
What is d?
14.
a = 10
b = "b"
a = b
b = b.upcase
c = b
What is a? What is c?
15.
a = 10
b = "5"
c = a.to_s + b
a = "A"
b = b.to_i
a = a.downcase + a + c
d = b + c.to_i
b = d.to_s + a.upcase!
What are a, b, c, and d?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment