When learning Ruby, I noticed that in all the examples there are no semicolons. I am aware that this is perfectly fine as long as each statement is on its own line. But what I am wondering is, can you use semicolons in Ruby?
Ruby doesn't require us to use any character to separate commands, unless we want to chain multiple statements together on a single line. In this case, a semicolon (;) is used as the separator.
Splitting lines with semicolons is something very important sometimes.
Say you want to calculate something trivial like depositing your money and want to calculate inflation. And let's say you don't want to do it in irb (because it's terribly buggy), you can use your shell, and a semicolon is needed: