Where is the error in this C# code ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Where is the error in this C# code ?

Why its not print "yes" ? https://code.sololearn.com/c21jHNEbv170/?ref=app

1st Sep 2020, 7:12 PM
Raven
Raven - avatar
5 Answers
+ 5
Console.WriteLine( a > b ? "yes" : "no" );
1st Sep 2020, 7:21 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 thanks, it's working well.. can you just give me more complex examples ? I'm new in c sharp...
1st Sep 2020, 8:08 PM
Raven
Raven - avatar
0
Complex examples of what? Code practice or challenges?
1st Sep 2020, 8:37 PM
Jayakrishna 🇮🇳
0
Jayakrishna🇮🇳 examples of this condition like print string without use console.write , I read this example and I can't get it a > b ? "Yes" : "no"
2nd Sep 2020, 6:52 AM
Raven
Raven - avatar
0
I don't understanding your question.. without using console.write to print output? The statement a > b ? "yes" : "no" ; is a ternary operator example, a shart form of if - else.. That if a > b is true then it executes 1st block after '?' otherwise, I. e a>b on false, then executes after ':' part. (that is else part..) So a > b true then it return 'yes', if false it returns 'no'..
2nd Sep 2020, 7:15 PM
Jayakrishna 🇮🇳