Click here to Skip to main content
15,887,683 members
Please Sign up or sign in to vote.
1.00/5 (4 votes)
I see this code and i need to see the result of this if possible

C#
if (a<10)
if(a>0)
messagebox("bad values");
else
messagebox("good values");


what is result if user enter number 7 and number 15 .

What I have tried:

C#
what is the result of this code by c#
Posted
Updated 6-Dec-16 9:32am
Comments
Richard Deeming 6-Dec-16 14:55pm    
The result of this code? A compiler error.

messagebox is not a built-in function, so unless you've defined it somewhere else, that code won't compile.

If it does compile, then you can easily find out the result by running it.
cvogt61457 6-Dec-16 15:00pm    
What are you trying to get?

Is this what you want?
1. Print "bad value" if 0

1 solution

Quote:
I see this code and i need to see the result of this if possible
There is an easy way to know, just try the code !

And if you use the debugger, you will even see what the code is doing.

You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.

Debugger - Wikipedia, the free encyclopedia[^]
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]

The debugger is here to show you what your code is doing and your task is to compare with what it should do.
There is no magic in the debugger, it don't find bugs, it just help you to. When the code don't do what is expected, you are close to a bug.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900