1 hour ago, Lactose said:
bool draw = isSlotTaken.All(x => x);
With the given example, I think draw will be true if every element of isSlotTaken is a bool with the value true.
This is what I thought as well, I have done some tests and I also think this is how it works.. but I copied the code from stack exchange, so I do not really understand why it works. I think that there is just a problem in my logic not setting true after completing, so in some it is resolving false when I think it should be true.
1 hour ago, Lactose said:
This sounds like a problem you should look into using a debugger -- are you familiar with debugging techniques? Breakpoints, etc.
No not really. I have only been coding for about a week, and learning from a book called "The C# Players Guide". I am using the free visual studio and if I press f5 and there is an error I can see some issues in the log thing. I do not know about breakpoints and stuff though or how to "watch" variables or w/e. I assume the book just hasn't gotten to that stuff yet.
1 hour ago, Rutin said:
bool allValuesTrue = true;
for (int a = 0; a < array.length; a++)
{
if (array[a].status == false) {
allValuesTrue = false;
// Code to exit loop
}
}
This looks like it also works.. I did a test but I do prefer the simple format of the other way, now I know it actually functions as I thought it would.
1 hour ago, Lactose said:
You should probably mention the progamming language used somewhere in the post. It looks like it's C#, so I'll assume that.
I've edited the OP Title to include that I am, indeed, talking about C#