Please help me with the code :Repost

N

NotYetaNurd

please try the following

float F1=1.0f;

float F2=1.0f;

string testString = " "+ ((F1-F2)>0)?"test1":"test2"; //throws error while
compilation

and

float F1=1.0f;

float F2=1.0f;

string testString = ((F1-F2)>0)?"test1":"test2";


Whatz wrong with the first snippet
 
J

Jon Skeet [C# MVP]

NotYetaNurd said:
please try the following

float F1=1.0f;

float F2=1.0f;

string testString = " "+ ((F1-F2)>0)?"test1":"test2"; //throws error while
compilation

and

float F1=1.0f;

float F2=1.0f;

string testString = ((F1-F2)>0)?"test1":"test2";


Whatz wrong with the first snippet

You've got a bracket in the wrong place. It should be:

string testString = " "+ ((F1-F2)>0?"test1":"test2");
 

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

Top