Re: type fruit(sequence unknown_fruit)
- Posted by vmars May 21, 2009
- 833 views
Do you mean like this?:
fruit fruit_check --defining a variable of type fruit if fruit("grapes") then --test of grapes is a fruit puts(1, "Valid fruit!\n") fruit_check ="grapes" --fruit check can now be "grapes" else puts(1, "Not a valid fruit, so added to list!\n") fruit_check = "grapes" --fruit_check can't be "pears" - will crash the program --add grapes to the list of valid fruits end if
fruit_check = "grapes" fruit_check can't be "pears" - will crash the program
Why, because "pears" is already there?
If so, What if I wanted two "pears" entries?
Thanks!