DEV Community

Felix Imbanga
Felix Imbanga

Posted on

String Interpolation/Refactoring in Ruby

You can always add + or << to add a variable value into a string "#{interpolation}"

Refactoring - fancy way of saying we're improving the structure or appearance of code without changing what it actually does.
Omit needless words
Make sure to us the when defining methods
Using puts inside methods is generally discouraged if the methods are meant to be used as part of a library or for refactoring values as it can lead to unwanted console output. puts is mostly used for debugging or for scraping that interaction directly with the user via the terminal.

Top comments (0)