C
C#5mo ago
Ewan

✅ Why is this not returning 20?

Why is this not returning 20?
No description
24 Replies
Jimmacle
Jimmacle5mo ago
what is it showing you? you should probably double check your assignments in the constructor
Ewan
EwanOP5mo ago
nothing
Jimmacle
Jimmacle5mo ago
i mean, you aren't telling it to do anything with the value that Show returns so if you expect that to show up somewhere then you have multiple problems
Ewan
EwanOP5mo ago
uhhh ill have a look
Jimmacle
Jimmacle5mo ago
you'll need to use methods on the Console class like Console.WriteLine if you want to output something to the console
Pobiega
Pobiega5mo ago
return doesnt print anything, it just tells the method to... well, return the value
Ewan
EwanOP5mo ago
No description
Ewan
EwanOP5mo ago
i tried this and its not showing anything
Pobiega
Pobiega5mo ago
you sure about that?
Jimmacle
Jimmacle5mo ago
that will definitely show something
Ewan
EwanOP5mo ago
oh wiat its showing 0
Pobiega
Pobiega5mo ago
yep
Ewan
EwanOP5mo ago
why isnt it showing the 20?
Jimmacle
Jimmacle5mo ago
yes, because of the other issue i mentioned
Pobiega
Pobiega5mo ago
look at your constructor you know what x = y; does, right?
Ewan
EwanOP5mo ago
makes x into y right?
Pobiega
Pobiega5mo ago
I'd phrase it as "sets X to the value of Y", but yeah
Jimmacle
Jimmacle5mo ago
yeah, so compare that with the code you have in the constructor and you'll probably see the issue
Ewan
EwanOP5mo ago
ok ill have a look thanks
Jimmacle
Jimmacle5mo ago
looks like your editor might already be trying to suggest a fix
Ewan
EwanOP5mo ago
AH I SEE IT ok ik where ive gone wrong now
Pobiega
Pobiega5mo ago
🙂
Ewan
EwanOP5mo ago
ok thanks!!
Jimmacle
Jimmacle5mo ago
:pepeok:
Want results from more Discord servers?
Add your server