From: Adam Akhtar Date: 2008-03-12T07:31:15+09:00 Subject: Re: whats the error here? Sorry for the sloppy quoting of my code. Here it is in full. I made a correction in the initialize method of passing a string and not an integer to find the length. This is my attempt of solving the rubyquiz lcd challenge. (please dont post your solution to the challenge - im determined to do it all by myself ;-) ) class Lcdscreen def initialize(size=2) @size = size @template = {'1'=> [" # ", "@ @"," # ", "@ @", " # "], '2'=>[" # ", "@ @"," # ", "@ @", " # "], '3'=>[" # ", "@ @"," # ", "@ @", " # "], '4'=>[" # ", "@ @"," # ", "@ @", " # "], '5'=>[" # ", "@ @"," # ", "@ @", " # "], '6'=>[" # ", "@ @"," # ", "@ @", " # "], '7'=>[" # ", "@ @"," # ", "@ @", " # "], '8'=>[" # ", "@ @"," # ", "@ @", " # "], '9'=>[" # ", "@ @"," # ", "@ @", " # "], '0'=>[" # ", "@ @"," # ", "@ @", " # "]} @numrows = @template['0'].length end def LCDWrite text 0.upto(@numrows) do |y| output = "" if (y%2==0) #if even print horizontal bars text.each_byte do |x| output << HorizontalBarPrint(x, y) end else #if odd print vertical bars 0.upto(@size) do |z| #have to print multiple lines for vertical bars text.each_byte do |x| output << VerticalBarPrint(x, y) end output << "/n" #after reaching the end of text add a newline end end puts output #print out the line end end def HorizontalBarPrint chr,segment lcdchar = @template[chr][segment] #more code to come but stuck on the above line it just wont work. end end ###################3 -- Posted via http://www.ruby-forum.com/.