Go Back   PCMech Forums > Help & Discussion > Web Design / Development

Need Some Help? Type Your Keywords Here:

Reply
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
Old 03-23-2002, 08:27 AM   #1
Member (5 bit)
 
Join Date: Dec 2001
Posts: 17
If function

Hi,

Could anyone explain to me the following code?

if(acquire(),NULL)
{
return true;
}

where acquire() is just a user-defined function.

Why is it the 'if' function can contain two parameters?

Thank you.
xgirl is offline   Reply With Quote
Old 03-24-2002, 10:46 AM   #2
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
First you have to tell us which programming language you are using.
aym is offline   Reply With Quote
Old 03-24-2002, 07:49 PM   #3
Member (5 bit)
 
Join Date: Dec 2001
Posts: 17
Hi,

I'm using C programming.
xgirl is offline   Reply With Quote
Old 03-24-2002, 08:33 PM   #4
Member (7 bit)
 
Join Date: Mar 2002
Location: Florida's Economy Sucks?
Posts: 74
Hola xgirl

The way I understand the IF statement is:

IF(expression) statement

Where expression is, you would have the the expression being evaluated. Where statement is you would have the instruction to execute. If the expression returns True, then the statement is executed. i.e

x=100

If(x==100)
cout << "x is 100";

If you have multiple lines of code to execute then:

if(x==100)
{
cout <<"The value of x is ";
cout<< x ;
}

You can have multiple expressions evaluated:

if(x==100 || x==0)
{
cout<<"The value of x is";
cout<< x ;
}

If x is 100 or 0 the code will be executed.

Hope that helps

jd

Last edited by j0hn d0e; 03-25-2002 at 06:59 AM.
j0hn d0e is offline   Reply With Quote
Old 03-25-2002, 06:24 AM   #5
aym
Registered User
 
aym's Avatar
 
Join Date: Nov 2001
Posts: 1,965
Quote:
Originally posted by xgirl
Hi,

I'm using C programming.
As I know (and I have some experience in C), if satement has only one usage, and j0hn d0e explained it well.
aym is offline   Reply With Quote
Reply

Bookmarks

Still Need Help? Type Your Keywords Here:


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is On
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -5. The time now is 07:53 AM.
Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.
SEO by vBSEO 3.6.0 PL2