FAQ: Arrays - Review

This community-built FAQ covers the “Review” exercise from the lesson “Arrays”.

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

Learn C#

FAQs on the exercise Review

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!

I would like to add at the end of this part that it would be good if 2D and 3D arrays were included in the lessons. I’ve noticed you’ve mentioned that the arrays we are doing are one dimensional, but there was no word about any others… googling got me some info though, but still they could’ve been mentioned explicitly if not covered.

4 Likes

Why does this run with an error:

using System; namespace ArraysReview { class Program { static void Main(string[] args) { /* use this space to write your own short program! Here's what you learned: Building Arrays .Length Property Accessing and Editing Arrays using bracketNotation[] Built-in-Methods: Sort(), IndexOf(), Find() Good luck! */ Console.WriteLine(Array.Sort(Array {335, 42, 24})); } } }

?

because you haven’t declare and initialize the array first.

Hello. So far I have really enjoyed when suggestions are provided for activities in the review stage. I know I can come up with ideas myself but it has really helped my engagement to have these suggestions. I also think that this would increase community engagement and discussion. Thank you and I’m really enjoying using Codecademy.

1 Like

using System;

namespace ArraysReview
{
class Program
{
static void Main(string args)
{
string jerbs = {“Janitor”, “Mechanic”, “Electrician”};
int jerbLevel = {1, 1, 5, 10, 15, 20, 25, 30};
Console.WriteLine(“Would you like to hear about the jobs? Type yes or no.”);
Console.ReadLine();
string answer = Console.ReadLine().ToLower();
}
}
}

So I’m obviously trying to set up some user interface here and when I get to this point of the coding, I receive the error:
“Unhandled Exception: System.NullReferenceException: Object reference not set to an instance of an object.
at ArraysReview.Program.Main(String args) in /home/ccuser/workspace/csharp-arrays-review/Program.cs:line 13”

My only reply to this is: “Wat?” Can someone explain this in a way an absolute, pretty slow, novice beginner could understand?

string answer = rAnswer == null ? null : rAnswer.ToLower();<<

That is what line 13 should look like. Sadly we haven’t really covered the truncation of:
string answer;
if (rawAnswer == null)
answer = null;
else
answer = rawAnswer.ToLower();

Fun times. I hope this helps anyone else having this problem! :smiley: If anyone wants to explain this for uber-baby-beginners like me, feel free to add on! Hopefully it will add to my (and others’) understanding!

using System; namespace ArraysReview { class Program { static void Main(string[] args) { /* use this space to write your own short program! Here's what you learned: Building Arrays .Length Property Accessing and Editing Arrays using bracketNotation[] Built-in-Methods: Sort(), IndexOf(), Find() Good luck! */ string[] favoriteChampion; favoriteChampion = new string[] {"omekamon", "greymon", "gulusgammamon", "teslajellymon", "garurumon", "symbaangoramon", "birdramon", "togemon", "kabuterimon", "angemon", "gatomon", "ikakumon"}; Console.WriteLine("Which of these concepts do you feel more affinity to (use the numbers)? inspired, 1-courage, 2-darkness within, 3-whimsy, 4-friendship, 5-trust, 6-love, 7-sincerity, 8-knowledge, 9-hope, 10-light, 11-reliability, 12-darkness"); string results = Console.ReadLine(); if (results != null) { int number = Int32.Parse(results); Console.WriteLine($"according to our argorithyms out of 12 handpicked digimon the one you have most affinity with is {favoriteChampion[number-1]}"); } } } }

hi I want to know what is the reason that I can’t type an answer to the console.

I would also LOVE to have a list of suggested exercise. It’s so hard to think of your own, when we’re not SUPER familiar with the concepts yet and what it can do!

Thank you for the super great course.