Skip to content

Instantly share code, notes, and snippets.

@icambridge
Created January 4, 2013 17:56
Show Gist options
  • Save icambridge/4454572 to your computer and use it in GitHub Desktop.
Save icambridge/4454572 to your computer and use it in GitHub Desktop.
Shows that the variable created within the scope of the begin end isn't destoryed after the loop.
people = ['one','two','three','four']
counter = 0;
begin
person = people[counter]
puts person
counter = counter + 1
end while not people[counter].nil?
puts person
@icambridge
Copy link
Author

Created as a note to self

output

one
two
three
four
four

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