Function that returns a boolean, boolean variables

Function that returns a boolean, boolean variables

Hi,

I'm trying to figure out what is wrong with my function... I'm having trouble using boolean variables.  I find this function works fine (returns a constant):


  1. bool PlayerGameAlreadyExists(string PlayerName, date GameStart)
  2. {
  3.     Exists = true;
  4.     return true;  // this line works fine, returning a constant
  5.     // return Exists;       // this line doesn't work, attempting to return a variable
  6. }


but if I try to return a boolean variable instead (see the commented out line above), I get an error message:

  1. Encountered ";" at line 4, column 18.
  2. Was expecting:
  3. "(" ...

I wondered if there's anything wrong with the way I'm defining / returning the variable?

Many thanks,
Katie