Ask your own question, for FREE!
Computer Science 7 Online
OpenStudy (anonymous):

This is about C# If the following code segment compiles correctly, what do you know about the variable x? if (x) Console.WriteLine("ok"); a. x is an integer variable b. x is a boolean variable c. x is greater than 0 d. none of these I'm thinking it is d. none of these since when I input this into the console I get an error since X isn't declared. I am new to programming and C# so I'm unsure of solving too many problems. Thank you to everyone who takes time to read this. I appreciate it.

ganeshie8 (ganeshie8):

question is just asking about the segment of code. so before we proceed - we need to assume here that x is declared and the segment is inside a class.

ganeshie8 (ganeshie8):

since in C# if condition only takes boolean expressions, x must be a boolean variable for the code segment to compile correctly.

OpenStudy (anonymous):

Thanks so much ganeshie8. Truly appreciate the explanation to the problem!

ganeshie8 (ganeshie8):

yw !

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
16 hours ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
19 hours ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Arizona: does anyone know the percentage rate of 30,000 and 40,000
1 week ago 0 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!