In Ruby, I know that control flow statements typically follow the following pattern.
If statement
do something
else
do something else
end
From my experiences that was the only pattern I noticed. However, when looking at code on a website, I saw something new that looked similar (if-then). I've never seen that before and would appreciate any explanations.
if statement then
do something
else
do something else
end
I'd like to know what the difference between those code blocks is. They seem to do the same thing.
Edit: I would like to clarify, I'm talking about an if then line followed by a block, not if then on one line. Please keep that in mind