IF Statements

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi, I'm still new to C# and haven't been able to find an solution to an IF
statement problem. Is it possible to use an OR condition in an IF statement,
i.e

if (fileExtention == ".tmp" or fileExtention == ".lsi")
{
other statements go here.....
}

Thank you
 
Hi Chuck831!
Hi, I'm still new to C# and haven't been able to find an solution to an IF
statement problem. Is it possible to use an OR condition in an IF statement,
i.e

if (fileExtention == ".tmp" or fileExtention == ".lsi")
{
other statements go here.....
}

Try:

if ( (fileExtention == ".tmp") || (fileExtention == ".lsi")) )
{
// other statements go here.....
}

For AND use "&&"

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/
 
Jochen Kalmbach said:
Hi Chuck831!

Try:

if ( (fileExtention == ".tmp") || (fileExtention == ".lsi")) )
{
// other statements go here.....
}

For AND use "&&"

--
Greetings
Jochen

My blog about Win32 and .NET
http://blog.kalmbachnet.de/

and and or are C++ keywords - one of the remaining places where Microsoft
hasn't yet become compatible.

/Peter
 
Peter Koch Larsen said:
and and or are C++ keywords - one of the remaining places where
Microsoft hasn't yet become compatible.

It's an extension *not* to have the keywords. :-)

If you choose Disable Microsoft Extensions, and and or works
according to the standard.


Bo Persson
 
Back
Top