How would I write if x is lower than y then do this??

Like

if(x == 50 or lower){

y = 5;
}
else{
y = 2;
}

Recommended Answers

All 4 Replies

I'm assuming you mean less then not lower?

if( x <= 50)
{
   y = 5;
}
else
{
   y = 2;
}

or

y = (x <= 50) ? 5 : 2;

Thanks wild goose. I totally forgot about less than and greater than..

NargalaX,

Please use code tags when pasting code:

[code=csharp] ...code here...

[/code]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.