Re: type fruit(sequence unknown_fruit)

new topic     » goto parent     » topic index » view thread      » older message » newer message

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!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu