RE: variable start values
- Posted by Jason Dube <dubetyrant at hotmail.com> Dec 10, 2003
- 508 views
Hi, Thanks for both replies...I understand clearly now, thank you. Mike Sabal wrote: > > > Jason, > By the time the function hits the return, there needs to be a value > assigned to capital1. If x[1][1] is less than 90, that happens. But if > not, there is no other place for the value to be assigned, so the > program crashes. You have to options to correct this: initialize > capital1 or add an else statement to assign a value to capital1. You > could also remove the variable altogether and use multiple returns. > > if x[1][1] < 90 then > -- do stuff > return 0 > else > return 1 > end if > > HTH, > Mike Sabal > > >>> dubetyrant at hotmail.com 12/10/2003 11:42:20 AM >>> > Jason Dube wrote: > > > > "capital1 has not been assigned a value" > > > > function check_for_punc_1(object x) > > boolean capital1 > > if x[1][1] < 90 then > > position(2,1) > > puts(1,"GARBLE: [Sentence is not capitalized...]") > > capital1=0 > > end if > > return capital1 > > end function > >