My code won't work (uhm total beginner here).

I can't really see the formatting of your code all that well as I'm using Tapatalk, but learn to use indentation (spaces before lines of code) to your advantage. It makes your code easier to read for yourself and others and makes the identification of missing or overused brackets and braces easier...
 
the brackets of your for loop should be { instead of (, ie for (conditions) {}. Then, brackets again, PrintFooToScreen{} should be PrintFooToScreen().

Read up on when to use the different types of brackets.
 
Too many or used the wrong type?

The problems are elementary dude. If you're stuck here, how are you going to progress?

Your code looks like crap on Tapatalk, but the obvious errors are too many closing braces in your first print method, a random closing bracket in the middle of your for loop in your second print method, along with the brackets and braces subsequently switched.

There may be other problems, but I'm not going to scrutinise code that looks like that any further.
 
Thank you to everyone who has replied so far:D

I can't really see the formatting of your code all that well as I'm using Tapatalk, but learn to use indentation (spaces before lines of code) to your advantage. It makes your code easier to read for yourself and others and makes the identification of missing or overused brackets and braces easier...
You mean // or /// or do you just mean pressing spacebar/enter?

Is '()' called brackets and '{}' called parenthesis?
the brackets of your for loop should be { instead of (, ie for (conditions) {}. Then, brackets again, PrintFooToScreen{} should be PrintFooToScreen().

Read up on when to use the different types of brackets.
Oh man I have much to learn. Thank you.
The problems are elementary dude. If you're stuck here, how are you going to progress?

Your code looks like crap on Tapatalk, but the obvious errors are too many closing braces in your first print method, a random closing bracket in the middle of your for loop in your second print method, along with the brackets and braces subsequently switched.

There may be other problems, but I'm not going to scrutinise code that looks like that any further.
Well, I have only watched one 15 min youtube video tutorial so I don't even know what crap code looks like. This is the first time I've ever even been exposed to any coding at all or even heard of Visual Studio. That's like yelling at a skinny person for not being muscular when they've only trained once in their entire life. :p

I'm trying to learn here, I've already learned a lot just by asking questions ITT.

Thanks for your help though, just keep in mind I need to learn everything. When you say 'first print method' are you referring to my first 'static void PrintFooToScreen()'?
 
Hmm, I changed it to 'for{int counter=0}; counter <= 100; counter++}' using { instead of ( and removed what seemed to be one } too many.

But I still get my 'void' underlined as in the aforementioned issue.
 
I think you need to download some youtube vids and ebooks. Study, practice, study, practice....over and over.
 
Hmm, I changed it to 'for{int counter=0}; counter <= 100; counter++}' using { instead of ( and removed what seemed to be one } too many.

But I still get my 'void' underlined as in the aforementioned issue.
You cannot use {}, use ()

for(int i =0;i<6;i++){
//do something
}
 
Last edited:
Is '()' called brackets and '{}' called parenthesis?

Oh man I have much to learn. Thank you.

Well, I have only watched one 15 min youtube video tutorial so I don't even know what crap code looks like. This is the first time I've ever even been exposed to any coding at all or even heard of Visual Studio. That's like yelling at a skinny person for not being muscular when they've only trained once in their entire life. :p

I'm trying to learn here, I've already learned a lot just by asking questions ITT.

Thanks for your help though, just keep in mind I need to learn everything. When you say 'first print method' are you referring to my first 'static void PrintFooToScreen()'?

Braces are not called parenthesis. Brackets are (), braces are {} and crotchets or square brackets are [].

You can tell which methods I was referring to just from my reference to the for loop.

Why are you trying to teach yourself C# using Youtube? You're going to be asking for help on MyBB every day at this rate. Rather sign up at Codecademy and do their helpful courses.

Hmm, I changed it to 'for{int counter=0}; counter <= 100; counter++}' using { instead of ( and removed what seemed to be one } too many.

But I still get my 'void' underlined as in the aforementioned issue.

I told you what you did wrong and you've done something else to correct it. In any case, the guy you tried to listen to was telling you to do a for loop like this:

for (int x = 1; x <= 20; x++)
{
Console.WriteLine(x);
}
 
I think you need to download some youtube vids and ebooks. Study, practice, study, practice....over and over.
+1
I only watched one video so far and I basically just tried to copy this guy, but the resolution of the video was too low for me too actually see his brackets every time even at 480p.

You cannot use {}, use ()

for(int i =0;i<6;i++){
//do something
}

That's what I had originally, I thought the '(' was the problem originally. I actually feel really stupid atm for not understanding this.

I don't know what '//do something' means.


Well... I'm off to the interwebz to try and learn more.
 
+1
I only watched one video so far and I basically just tried to copy this guy, but the resolution of the video was too low for me too actually see his brackets every time even at 480p.



That's what I had originally, I thought the '(' was the problem originally. I actually feel really stupid atm for not understanding this.

I don't know what '//do something' means.


Well... I'm off to the interwebz to try and learn more.
"//" makes words after the double slash comments in your code

I wrote do something just to illustrate whatever you want your code to do like print to the screen, it will do it 5 times in the loop.
 
Braces are not called parenthesis. Brackets are (), braces are {} and crotchets or square brackets are [].

You can tell which methods I was referring to just from my reference to the for loop.

Why are you trying to teach yourself C# using Youtube? You're going to be asking for help on MyBB every day at this rate. Rather sign up at Codecademy and do their helpful courses.



I told you what you did wrong and you've done something else to correct it. In any case, the guy you tried to listen to was telling you to do a for loop like this:

for (int x = 1; x <= 20; x++)
{
Console.WriteLine(x);
}

Much appreciated, really.

I signed up at Codeacademy, but I can't find 'C#' I only see Python, javaScript, PHP and a few others.

Thanks again everyone, especially for being so patient.
 
+1
I only watched one video so far and I basically just tried to copy this guy, but the resolution of the video was too low for me too actually see his brackets every time even at 480p.



That's what I had originally, I thought the '(' was the problem originally. I actually feel really stupid atm for not understanding this.

I don't know what '//do something' means.


Well... I'm off to the interwebz to try and learn more.
You're supposed to feel stupid because you're not approaching it correctly. Forget about youtube and do some entry level tutorials on code academy. They'll explain the correct use of braces, brackets, etc.

You can't build a house without a foundation.
 
Much appreciated, really.

I signed up at Codeacademy, but I can't find 'C#' I only see Python, javaScript, PHP and a few others.

Thanks again everyone, especially for being so patient.

Doesn't matter, do Java, very similar to C#
 
Youtube isn't that great for learning coding.
Make sure your brackets match everywhere. Use round brackets () for ifs/for's/method headers, usually used to make code read easier and to separate parts.

Use {} curly brackets to make code blocks. A block can be a namespace/class/method or just a group of code.

Use the built in help as well. When you get an error, double click the first one to go to it (usually its the first one that might be causing the rest to fail, but not always).
 
Last edited:
Top
Sign up to the MyBroadband newsletter
X