I think I'm going crazy. I tried to write a fairly simple program to
test ljust, center and rjust. But I cannot make the page numbers of my
table of contents line up. I tried to account for the string length of
the chapter and topics; I've tried a lot of things and I just cannot get
the page numbers to line up. If anyone knows how to do it please let me
know. I don't think I'll be able to go to bed without figuring it out.
Here is my latest code and output:
////////// code //////////////
class TableOfContents
attr_accessor :chapters, :topics, :pages
end
I think I'm going crazy. I tried to write a fairly simple program to
test ljust, center and rjust. But I cannot make the page numbers of my
table of contents line up. I tried to account for the string length of
the chapter and topics; I've tried a lot of things and I just cannot get
the page numbers to line up. If anyone knows how to do it please let me
know. I don't think I'll be able to go to bed without figuring it out.
Here is my latest code and output:
////////// code //////////////
class TableOfContents
attr_accessor :chapters, :topics, :pages
end
Thanks. I am using FreeRIDE and the output shows up differently, but if
I copy and paste the output to a text file it is lined up like it is
supposed to be.