FAQ: Data Types - Handling Errors

This community-built FAQ covers the “Handling Errors” exercise from the lesson "Data Types and Variables ".

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

Learn C#

FAQs on the exercise Handling Errors

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!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

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 get that “number” and “lock” should be a decimal and “lock” should be changed or replaced, but when I exchange the data type to “decimal” or “double” I produce an error. How would these numbers be handled in C#?

1 Like

I’m just seeing a bunch of gobbledygook in my console no text line with the errors that were shown in the reference tab any one else having this issue?

1 Like

i cant seem to get past this lesson, everything seems good, not returning any errors, wrote lines to print to console and everything prints out as its entered, any ideas?

@chip4597530281 I had the same problem. Once I went hit back to go back to an older example and then came back to the lesson it allowed to go to the next problem

2 Likes

that works, thanks. Sit on this problem 20 minutes.

Having the same issue.

Leave it for a few minutes then it’ll pass.

Just a suggestion, maybe this page should come before the “Creating variables with types”, as it will reassure new learners when they encounter errors, and also it mentions that a semicolon should be used to end each line.

2 Likes

Hi Brantaylo

Lock is KeyWord and you can’t use it as variable.

3 Likes

decimal number = 38498.3222M ;

SHOULD BE LIKE THAT
that’s what the console say

Hey, arcblaster 60412

Thank you for letting me know!

Hi @wcroman, I am having the same issue as you described, in part 3 of this lesson as well as part 4. Did you ever find a resolution to the problem? Thanks!

Thank you. I was stuck in this dumb level for a while trying to figure what the heck wrong.

It seemed to let me move on without actually fixing all the errors, but I wanted to do this exercise right. If you need a hint, just don’t forget your semicolons after each line.

Also, some of the names of variables don’t seem to work. I didn’t know what they wanted the names of the variables to be but I just changed them to something random and that worked.

And make sure you have the right data type attached to each one.

Hope that helps if you’re struggling like me, an absolute programming beginner!

It seems most errors in the console begin like this:

Program.cs(8,5)
Program.cs(13,14)
Program.cs(21,1)

I didn’t see anything in the material that teaches us what the numbers in the parentheses mean. Does anyone know?

1 Like

first number is the line of the error and second number is the first character where the problem begins on that line (i.e. the 12th character of the line).

2 Likes

you can see the full code in details here:

Excellent! Thank you very much.

1 Like

i dont know whats wrong with mine here it is
using System;

namespace BugSquasher
{
class Program
{
static void Main(string args)
{
double number = 38498.3222;

 string dinosaur = "Barney";

  int lock = 293.000;

  bool yes = true;

  string band = "The Low Anthem"

}

}
}