We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
defblock_message_printermessage="Welcome to Block Message Printer"ifblock_given?yield#Callstheblockpassedtothemethodendputs"But in this function/method message is :: #{message}"endmessage=gets.chompblock_message_printer{puts"This message remembers message :: #{message}"}#####################################################################################defproc_message_printer(my_proc)message="Welcome to Proc Message Printer"my_proc.call#CalltheProcputs"But in this function/method message is :: #{message}"endmy_proc=proc{puts"This message remembers message :: #{message}"}proc_message_printer(my_proc)##################################################################################### deflambda_message_printer(my_lambda)message="Welcome to Lambda Message Printer"my_lambda.call#CalltheLambdaputs"But in this function/method message is :: #{message}"endmy_lambda=->{puts"This message remembers message :: #{message}"}lambda_message_printer(my_lambda)
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Closures
You are viewing a single comment's thread. Return to all comments →