-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Karthikeyan A K
committed
May 29, 2015
1 parent
884d450
commit 438b968
Showing
2 changed files
with
25 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# keyword_argument.rb | ||
|
||
def say_hello name: "Martin", age: 33 | ||
puts "Hello #{name} your age is #{age}" | ||
end | ||
|
||
say_hello name: "Joseph", age: 7 | ||
say_hello age: 21, name: "Vignesh" | ||
say_hello | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
# regexp_dynamic.rb | ||
|
||
Friends = [ | ||
"Bharath - Looks like alien", | ||
"Nithya - The MBA. Oh NOOOOOO", | ||
"Tat - The eskimo from Antartica", | ||
"Kannan - Eats lot of bondas", | ||
"Karthik - Loves briyani" | ||
] | ||
|
||
print "Enter search term: " | ||
term = gets.chop | ||
regexp = Regexp.new term | ||
searched_friends = Friends.collect{|f| f if f.match regexp}.compact | ||
puts searched_friends.join "\n" |