Created
February 21, 2015 00:09
-
-
Save swistak35/e79976173b309fa0cf67 to your computer and use it in GitHub Desktop.
$... are global variables, except that no
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
str = "The quick fox and dog trololo" | |
/fox/.match(str) | |
def search2(str) | |
/and/.match(str) | |
puts "Inside method2: #{$&}" | |
end | |
def search(str) | |
/dog/.match(str) | |
search2(str) | |
puts "Inside method: #{$&}" | |
end | |
search(str) | |
puts "Outside method: #{$&}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment