simple quest: how to check return value of bool method

  • Thread starter Thread starter CCLeasing
  • Start date Start date
C

CCLeasing

Hi i am calling a bool method like so

checkduplicates(@"c:\saved.txt", report);

it either returns true or false, I want to do something if it's
returned true, and something else if it's returned false. How do i
check the return value of the method?
 
CCLeasing said:
Hi i am calling a bool method like so

checkduplicates(@"c:\saved.txt", report);

it either returns true or false, I want to do something if it's
returned true, and something else if it's returned false. How do i
check the return value of the method?

Well, either (method name changed to the conventional form):

bool result = CheckDuplicates(@"c:\saved.txt", report);

if (result)
{
...
}
else
{
...
}


or more simply:

if (CheckDuplicates(@"c:\saved.txt", report))
{
...
}
else
{
...
}

Jon
 
Back
Top