How to use the concept of String Building
A brief description: String Building involves the careful preparation of strings to be used elsewhere in the program. Typically this takes the form of manipulating a string to be used with a puts statement.
Say you have a puts statement. We all know that puts adds a hard return (new line) at the end, so two puts back to back will print on different lines. There are ways to stop puts from doing that, but it’s typically more clear to simply avoid the problem. Say also that the reason you want to use different lines is because you are printing something that takes a lot of space to calculate. It can also be used to build single lines of repeating patterns.
Continue reading ‘How to use the concept of String Building’ »