Simplying this conditional statement -- please help!

A

almurph

Hi,

Could anyone help me simplfy this conditional statement into
somethign more C# like. The C condition is:

if ((A = B - C) > D)
{

//do something
}

where A is type double
where B is type double array
where C is type double
where D is type double


I'm not confused by the types but by the "A = B - C" bit confuses
me (relative to C#)

Would appreciate any comments/suggestions/ideas/code-samples that you
may be able to offer.

Cheers & thanks,
Al.
 
D

Daniel Kraft

Could anyone help me simplfy this conditional statement into
somethign more C# like. The C condition is:

if ((A = B - C) > D)
{

//do something
}


Don't know if this is "more C# like", but it may be simpler in some
terms (and should do the same):

A = B - C;
if (A > D)
{
..
}

Cheers,
Daniel
 
J

jameskuyper

Hi,

Could anyone help me simplfy this conditional statement into
somethign more C# like. The C condition is:

if ((A = B - C) > D)
{

//do something
}

where A is type double
where B is type double array
where C is type double
where D is type double


I'm not confused by the types but by the "A = B - C" bit confuses
me (relative to C#)


I know nothing about C#, so I can't help you there. However, I suspect
that what's actually confusing you might not be a C# issue but a C
issue. Do you understand what the following expression means in C?

(A = B - C) > D

Do you know how the value of that expression is calculated? Do you
know what side effects it has? Do you you understand how the value of
that expression is used when it appears as the condition of an if()
statement? If not, that is something we can help you with.
 
A

almurph

   Could anyone help me simplfy this conditional statement into
somethign more C# like. The C condition is:
if ((A = B - C) > D)
{

   //do something
}
where A is type double
where B is type double array
where C is type double
where D is type double
   I'm not confused by the types but by the "A = B - C" bit confuses
me (relative to C#)


I know nothing about C#, so I can't help you there. However, I suspect
that what's actually confusing you might not be a C# issue but a C
issue. Do you understand what the following expression means in C?

    (A = B - C) > D

Do you know how the value of that expression is calculated? Do you
know what side effects it has? Do you you understand how the value of
that expression is used when it appears as the condition of an if()
statement? If not, that is something we can help you with.- Hide quoted text -

- Show quoted text -


Thanks guys. Sorted.
 
N

Nelu

Hi,

Could anyone help me simplfy this conditional statement into
somethign more C# like. The C condition is:

if ((A = B - C) > D)
{

//do something
}


This is the same as:
A=B-C;
if(A>D) {
//do something
}

You may be able to write it exactly the same in C# but I don't know the
language so I can't tell.

I'm not confused by the types but by the "A = B - C" bit confuses
me (relative to C#)

Would appreciate any comments/suggestions/ideas/code-samples that you
may be able to offer.


Although C and C# are similar in name, they are completely different
languages. C# is not discussed here so you may be able to get more help
in a group that's dedicated to it. Maybe
microsoft.public.dotnet.csharp.general is appropriate.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,007
Latest member
obedient dusk

Latest Threads

Top