if-elsif no conditions
Here where you are mistaken. puts
are conditions. There are no bodies in this fragment, only conditions.
Here is your code, correctly formatted.
if puts "A"
elsif puts "B"
end
And why does it execute both branches?
puts
returns nil, false. That is why he is trying both branches. If this code had else
, it would also be executed.
source
share