From: Frederick Cheung Date: 2008-08-06T04:49:29+09:00 Subject: Re: While loop with fixnum - not working On 5 Aug 2008, at 19:38, Mmcolli00 Mom wrote: > I can't get the while loop to work. When I set ErrorCount.Class it > outputs Fixnum. Do you think that this is the reason that that the > while Fixnum is a subclass of Integer. For performance reasons, small integers will be an instance of Fixnum. This is normal. (not terribly relevant here, but it doesn't really mater what ErrorCount is as long as it has a < method which will accept 0 as an argument) > > will not execute? Thanks in advance. Mom Mcolli00 > > it ("Search for FieldId Tag containing error in XML file") do > ErrFieldID= get_xml_attrib_value(ie, "Error","FieldID") > > ErrorCount = ErrFieldID.size #this lets me know what size the > array > is > puts ErrorCount.class #this shows that it is a Fixnum > ErrorCount.to_int #this does nothing > puts "Total Claim Errors" > puts ErrorCount #shows correct count! > end > > #this while structure will not work > In what way is it not working ? (assuming the problem is not just that while and end should be lowercase) Also in ruby a leading capital letter indicates a constant, so you'll probably get errors about "already initialized constant Foo" with code like this Fred > While ErrorCount > 0 > ErrFieldID = get_xml_attrib_value(ie,"Error","FieldID") > code to correct error > End > -- > Posted via http://www.ruby-forum.com/. >