Trying to make a table of contents as suggested by this tutorial:
http://pine.fm/LearnToProgram/?Chapter=05
But when I try :
Code:
puts str1.ljust (linewidth/2) + str2.rjust (linewidth/2)
I get the error:
Code:
text.rb:31: syntax error, unexpected tLPAREN_ARG, expecting keyword_end
	puts str1.ljust (linewidth/2) + str2.rjust (linewidth/2)
Which is perplexing to me because I wrote the code pretty much exactly as suggested by the tutorial.
Could anyone explain what is going wrong?
Full code is below:
Code:
class StdClass
	def initialize
	linewidth = 50
	str = "--->text<---"
	str1 = "Chapter 1"
	str2 = "Letters"
	str3 = "Page 1"
	str4 = "Chapter 2"
	str5 = "Numbers"
	str6 = "Page 50"
	puts str1.ljust (linewidth/2) + str2.rjust (linewidth/2) 
	#puts str.ljust (lineWidth/2) + str.rjust (lineWidth/2)
		
	end
end

x = StdClass.new