I'm having a little problem, when I start debugging no matter what value I assign x it always says "correct". However I specified that it should display that message only when x=5
Here is my code
You aren't testing if x == 5. One = is the assignment operator. What you are doing is assigning the value of 2 + 3 to x. Then testing the value of x, which is 5. Since 5 is not 0, it is true, and this outputs your "Correct" string. To compare the value of x is equal to 5, you use the equals to operator, or ==.
Also, and a minor note, but you are using two different formatting styles for your braces. The if statement has bother of its braces on the same line as the if statement. I use this style myself as it kind of helps me keep track of which blocks belong to with loops and such. But the else statement has the open brace with the else statement. Both are valid and widely used forms, and not really a big deal on a simply program like this, but when you get into larger programs with multiple nested if and loops and such it can have a huge impact on readability using different styles.