Re: Eu improvements (part 4)
- Posted by cklester <cklester at yahoo.com> Jan 06, 2007
- 704 views
Karl Bochert wrote: > > I might use structures to organize the fields of a customer list, but > I would want type() to validate that a zipcode is ok. Or you could create a structure for the zip variable... type Zip(sequence z) -- the type way if all_numbers(z) then return length(z) = 5 or length(z) = 9 else return -1 end if end type sequence Zip is integer a, b, c, d, e where a in {0,1,2,3,4,5,6,7,8,9} -- pseudo code b in {0,1,2,3,4,5,6,7,8,9} c in {0,1,2,3,4,5,6,7,8,9} d in {0,1,2,3,4,5,6,7,8,9} e in {0,1,2,3,4,5,6,7,8,9} end where end sequence sequence ZipPlus is integer a, b, c, d where a in {0,1,2,3,4,5,6,7,8,9} b in {0,1,2,3,4,5,6,7,8,9} c in {0,1,2,3,4,5,6,7,8,9} d in {0,1,2,3,4,5,6,7,8,9} end where end sequence sequence ZipCode is Zip zip_code ZipPlus zip_plus end sequence ZipCode z z.Zip = "12345" z.ZipPlus = "9876" :) -=ck "Programming in a state of Euphoria." http://www.cklester.com/euphoria/