Exercise 6: Strings And Text
While you have already been writing strings, you still do not know what they do. In this exercise we
create a bunch of variables with complex strings so you can see what they are for. First an explanation
Chapter 12. Putting It All Together: Tic-Tac-Toe
1. You will no longer use programming elements in isolation; writing programs rarely
involves using only if statements, loops, or objects.
2. Typically, all programming elements are interleaved.
3. The chal
Chapter 11. File Input/Output
1. All of our programs have taken a data set of values from user input
2. Any given program took in one data set, which consisted of one or more related
values from the user, and then performed a computation based on that dat
Chapter 5. Loop Structures
1. These tools include the while loop, the until loop, the for loop, and the concept of nested loops.
2. The job of any loop is to perform iteration or repetition, and the simplest construct for doing this is
known as a while lo
Chapter 8. Using Objects
1. Objects and object-oriented programming simplify the implementation of large programs
2. If you work on a program by yourself, it is up to you to organize your work.
3. If you work with 100 other programmers, then everything mu
Chapter 6. Arrays
1. An array is an ordered list of variables.
2. Arrays start counting their elements, or individual variables, at index 0, as the index is the offset
from the beginning of the array. Index 0 is the position of the first element in any ar
Chapter 7. Sorting and Searching
1. Entire books have been written on sorting and searching with computers.
2. To evaluate an algorithm, a common approach is to analyze its complexity. That is, we essentially
count the number of steps involved in executin
Chapter 9. Defining Classes and Creating Objects
1. This is essentially the syntax for instantiating a new object.
2. Ruby provides many built-in classes like strings and arrays, but you can also create your own class.
3. ser-defined classes are a great w
Chapter 3. Core Programming Elements
1. A variable is a piece of data attached to a name.
2. In most programming languages, variables are defined just as in algebra and can be assigned
different values at different times.
3. To create a variable in Ruby,
Chapter 4. Conditional Structures
1. Every algorithm has some type of logic flow.
2. A certain condition must be met to carry out the next step, is called conditional flow.
3. When more than one flow option exists in the control flow, it is called a condi