FAQ: Method Calls and Input - Call a Method

This community-built FAQ covers the " Call a Method" exercise from the lesson “Method Calls and Input”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Learn C#

FAQs on the exercise _ Call a Method_

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 (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 (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 (like) to up-vote the contribution!

Need broader help or resources? Head to Language Help and Tips and Resources. If you are wanting feedback or inspiration for a project, check out Projects.

Looking for motivation to keep learning? Join our wider discussions in Community

Learn more about how to use this guide.

Found a bug? Report it online, or post in Bug Reporting

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

where does the counting for the start index begin??quite confusing to me…the numbering starts from 0 right which is the first char in the string ??need help understanding this…thank you

In programming languages, indexes start from 0.

This is a bit confusing since it wants us to use Substring and define 2 numbers, using msg.Substring(0); returns negative. Yet my understanding of the 3rd instructions to find only the first letter… why is then the solution msg.Substring(0,1);???

The Math.Min() expects two number inputs. When we look at the third instruction we need to declare where we want the Math.Min() method to start and when to end for the string. 0 being the first letter and 1 being the second letter in the string. Which will display “Ya”

This is incorrect. We are using the .Substring() method in the third instruction. The .Substring() method can take two arguments, an index (starting place), and the length of the substring. If the method is only given one number, it will start at that index and continue until the end of the string.

If we just use msg.Substring(0) , this will return the full string, because we’ve started at index 0 and gone to the end of the string.

If we give it a length using msg.Substring(0,1) it will start at index 0, and return a substring with a length of 1 character.

So msg.Substring(0, 1) will return the substring “Y”
If we wanted the substring “Ya” we would need to change the length (aka the second argument) to 2.

Alternately, since we just need one letter, we could just use the index value of the string msg[0]

1 Like