C#C
C#10mo ago
retro!

Error with Console and int variables. Syntax error?

Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("nice! i'm a yellow guy, fyi! " + favouriteColor + " is still very cool, though.");
Console.WriteLine("... \nhey! i've been working on my math recently, how about we give it a go?");
Console.WriteLine("type one number you want for me to add to another, \n make sure it's just a number and nothing else!")

Console.ForegroundColor = ConsoleColor.Blue; 
int num01 = Convert.ToInt32( Console.ReadLine() ); /* < this is a conversion! it always goes at the start of 
you're converting, and you also want to include it's call brackets with it! or, right next to it... */

Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine(num01 + "! great choice! now for what you want to add to it.");

Console.ForegroundColor = ConsoleColor.Blue;
int num02 = Convert.ToInt32( Console.ReadLine() );

Console.ForegroundColor = ConsoleColor.White;
Console.WriteLine("that would be.... " num01 + num02 );

Console.ReadKey(); // < this is the end, though. it can register once you press any key!

// // ^ these however, are Methods/Functions, these are the stuff that actually DO things, not just change them.
image.png
Was this page helpful?