0

I don't understand the if(!move(tile)) condition in pset3. Can anyone please explain it to me? Can I change this code?

1 Answer 1

2

if (!move(tile)) is a shortcut for

bool didItMove = move(tile);
if (didItMove == false)
{
   // do this
}

In other words, it first calls the move function (that you are writing), passing in the tile (the number that the user entered). If that function returns false (i.e., it was an invalid move), then do whatever is in the statement following.

1
  • many thanks for that got it now
    – biggrey54
    Jul 28, 2014 at 23:09

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .