1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
|
def test
alreadyexists1 = 40
if true
alreadyexists2 = 50
alreadyexists3 = 50
end
notusedinexpression = 60
alreadyexists4
# Start of expression
newvar = 50
puts alreadyexists1
puts alreadyexists2
alreadyexists4 = 50 # Written before a read - no need to pass in
puts alreadyexists4
alreadyexists2 = alreadyexists1 + 10
alreadyexists3 = alreadyexists1 + 10
notusedoutsideblock = 50
puts notusedoutsideblock
notusedanywhere = 30
usedlater = 30
# end of refactored expression
if (true)
puts usedlater
puts alreadyexists2
end
end
|