Computer Science Canada Checking An Array For Validity |
Author: | Archi [ Sun Jul 20, 2003 6:53 pm ] |
Post subject: | Checking An Array For Validity |
How would I go about checking to see if every part of an array is either valid or invalid. I'm going ot use this for my workshop type system for my game. And if every part of the array is " " or has nothing in it, then i don't want to give the user the option to use that part of the workshop. But if it does have something in it, then i'd like for that part to be shown. |
Author: | AsianSensation [ Sun Jul 20, 2003 6:59 pm ] | ||
Post subject: | |||
as far as I know, you cannot check to see if a variable contains a value or not.
this simple piece of code gives a value to a if "y" is inputted as an answer. However, if something else is inputted, a will not be assigned a value. In turing, you cannot check to see if a variable contains value or not. also, what do you mean by valid? Could you specify that? The best bet is to assign every element of the array a value, such as a blank, and when you compare value, if it's a blank, then you know it's invalid, again, I need a specific definition for valid. |
Author: | Archi [ Sun Jul 20, 2003 7:29 pm ] |
Post subject: | |
Well in the workshop, they combine 2 items together and if they have any gems they will also appear so that they can choose to use them... But if they don't have any, I don't want the array which would hold the gems in to appear. So either the array would hold a gem name or just a " " |
Author: | Dan [ Sun Jul 20, 2003 8:28 pm ] | ||||
Post subject: | |||||
i there are two ways i whould do this: 1. use two arrays, one with on or " " and one with what the room is
the othere way i whould use is to just use one with everything in it:
|
Author: | krishon [ Mon Jul 21, 2003 9:02 am ] |
Post subject: | |
lol, Dan told u asian |
Author: | AsianSensation [ Mon Jul 21, 2003 4:44 pm ] |
Post subject: | |
krishon wrote: lol, Dan told u asian
huh? what? Dan told me how? |
Author: | SilverSprite [ Mon Jul 21, 2003 5:25 pm ] |
Post subject: | |
Dont act all innocent Asian.. hahahahaah |
Author: | PaddyLong [ Tue Jul 22, 2003 3:08 am ] | ||
Post subject: | |||
a boolean fucntion for this would be good
|