I have got a code which if,unless block a number of times like this:
Option is hashmap.
unless functioncall? options[:product]
puts "Hello wrold"
end
Can anyone explain the flow of this unless block. I am new to ruby and I use curly braces block in place of this.
translation to if-syntax
In
ifsyntax, this is equivalent to:OR
Output of boolean method
The method
functioncall?(options[:product])will return true if the options hash has a key calledproduct.Output of your method
Depending on the contents of the options hash, the method above will produce: