There are currently no frequently asked questions associated with this exercise – that’s where you come in! You can contribute to this section by offering your own questions, answers, or clarifications on this exercise. Ask or answer a question by clicking reply () below.
If you’ve had an “aha” moment about the concepts, formatting, syntax, or anything else with this exercise, consider sharing those insights! Teaching others and answering their questions is one of the best ways to learn and stay sharp.
Join the Discussion. Help a fellow learner on their journey.
Ask or answer a question about this exercise by clicking reply () below!
You can also find further discussion and get answers to your questions over in Language Help.
Agree with a comment or answer? Like () to up-vote the contribution!
Someone explain me please this lesson. I don’t understand one thing in here. Now this course is about Methods only, but you guys write everything in Main().
I’m just siting all day (bathroom, bedroom, WC) and trying to figure out how to write everything in different methods cheatsheet also showing in diferent methods…, and call them from Main() and now I see that others just write everything in Main()… OH MY GOD
I’m confused. When methods use out is that always declared in the definition of the method, or is that something you throw in when you call the method?
And if it’s in the definition then why use out when you could just return a value?
Is out a way to prevent errors when a method is misused?
If I understand your question, I think you’re asking why use separate methods when everyone you see is just writing everything in Main().
The purpose of having separate methods is to make fixing, changing, and using code easier. When everything is mixed together it’s hard to find which pieces affect the rest.
Fixing: If you find a mistake in a big program it is hard to determine what changing this line here will do to the rest of the program. And is it really this line here or another line 100 lines up? Keeping things separate helps because it’s easier to see what effects what.
Changing: Let’s say after you write code you decide you want to make it do something new. Now you have to go in and change some variables and some outputs. Again, who is to say what will happen if you change this line here? Will this create problems later in the program? Having things separate means we can easier change this or that part and know the rest will still work the same.
Using Code: When you have a piece of code separated out into a method that you can call, you only have to write it once and can reuse it over and over with very little work. If you write everything in Main() then you have to rewrite or copy and paste your work to use it again. (This also makes it harder for you and others to read later.)
In conclusion, using methods outside of Main() makes your code easier to read, easier to fix errors, easier to change/update, and easier to use while you program. Very useful tool!
I am so lost in this exercise. I literally have no idea of what I am supposed to do and it feels mighty frustrating. I am ready to just give up and conclude this is not for me. I look at the solution and that does not help. I am stuck at the second part of the exercise. The solution does not have any part where “static public bool tryparse” is used but the hint gives that as the method signature, whatever that means. It just feels like someone is giving me instuctions in martian and I just hear sounds that make no sense.
Guys, can anyone simply explain what out does and how exactly do you use it? I tried to find a good explanation, but in documentation there is huge difficult explanation, and I haven’t found anything on youtube abt it but difference between ref and out, when I know neither of these keyword. Help me out please!