Quote:
Originally Posted by dampyr
Whole code:
Especially this part is confusing:if (assigned[destCard] == false)
|
The if statement is explained on page 73. This statement requires an expression that returns true or false. If it returns true, the next statement is invoked.
assigned is an array of Booleans. Arrays are explained on page 110. With the brackets the array implement an indexer. destCard is an int that is passed to the indexer of the array to access a single element.
The returned element of the array is compared to false with the == operator. The == operator is explained on page 60.
If the returned element from the assigned array returns false, the comparision false == false returns true, and thus the next statement is invoked.
If the returned element from the assigned array returns true, the comparision true == false returns false, and thus the next statement is not invoked.
Instead of writing
if (assigned[destcard] == false)
you can also write
if (!assigned[destcard])