r/CodingHelp • • Mar 08 '20

[C#] Why isn’t my stuff showing up in the console?

Post image
15 Upvotes

14 comments sorted by

4

u/Boris-Holo Mar 08 '20

you are grtting user input before writing to the console, so the console waits until you enter something before it showa the text you want.

1

u/[deleted] Mar 08 '20

How could I fix it? I’m sorta new to this stuff lol.

2

u/[deleted] Mar 08 '20

put what you want it to say before the user input part

1

u/[deleted] Mar 08 '20

It tells me “Use of unassigned local variable ‘userInput’”

2

u/Boris-Holo Mar 08 '20

I just realized you also are doing readLine twice. I think you just want to enter a number? all you have to change is move the writeline beore you read user input

1

u/[deleted] Mar 09 '20

Thanks!

2

u/[deleted] Mar 08 '20

[removed] — view removed comment

2

u/[deleted] Mar 08 '20

I fixed it, I had to replace two lines and remove an unnecessary method.

2

u/Famous_Profile Professional Coder Mar 08 '20

What happens? What is the error? Try switching lines 12 and 13 and remove line 14

2

u/[deleted] Mar 08 '20

It worked, thanks!

2

u/KTthemajicgoat Mar 09 '20

While others have solved the issue, try using and else if statement instead of 2 ifs. Once you have more if statements it will get confusing to figure out which one does what

1

u/[deleted] Mar 09 '20

Thanks, will do!

1

u/lightlysaltedStev Mar 09 '20

Ahh I LOVE seeing posts like this ! I came to this group to give new people some help with their first programs and stuff but every group I’ve joined it feels like everyone uploads huge programs that I can’t be bothered to go through and work out 😂😂 want more posts like this where you can just glance up and down and work out the problem ! I’ve seen you’ve figured it out now though op 👏🏻🙌🏻🙌🏻

1

u/ZacC15 Intermediate Coder Mar 09 '20

You haven't tied anything to Console.ReadLine(). Try int userInput = int.Parse(Console.ReadLine());