Skip to content

Commit

Permalink
keyword_argument.rb added
Browse files Browse the repository at this point in the history
  • Loading branch information
Karthikeyan A K committed May 29, 2015
1 parent 884d450 commit 438b968
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
10 changes: 10 additions & 0 deletions keyword_argument.rb
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

15 changes: 15 additions & 0 deletions regexp_dynamic.rb
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"

0 comments on commit 438b968

Please sign in to comment.