✅ // See https://aka.ms/new-console-template for more information// This is another comment line//
why is this not working
5 Replies
// See https://aka.ms/new-console-template for more information
// This is another comment line
// Declare a (string) variable
string myFriendsName;
// assign a value to the myFriendsName variable
myFriendsName = "Jannick";
// use/access the variable
Console.WriteLine(myFriendsName);
Console.ReadKey();
C# console app template changes in .NET 6+ - .NET
The .NET 6+ project template for C# console apps uses top-level statements. Understand what changed and how to use existing learning materials with the new syntax.
thsi
this code
What specifically doesn't work?
$details
When you ask a question, make sure you include as much detail as possible. Such as code, the issue you are facing, what you expect the result to be, what .NET version you are using and what platform/environment (if any) are relevant to your question. Upload code here https://paste.mod.gg/, save, and copy the link into chat for others to see your shared code! (see $code for more information on how to paste your code)
And do you get any errors?