C
C#4mo ago
Crunchy

✅ how to start

help
No description
41 Replies
Crunchy
CrunchyOP4mo ago
in VSC im trying to make a symbol thing to start out wiuth i get this issue when clicking f5
Crunchy
CrunchyOP4mo ago
No description
Crunchy
CrunchyOP4mo ago
No description
Crunchy
CrunchyOP4mo ago
No description
Crunchy
CrunchyOP4mo ago
i have both of these installed
reflectronic
reflectronic4mo ago
you need to make a project you can't just have a .cs file
Crunchy
CrunchyOP4mo ago
SO i need to use community version?
reflectronic
reflectronic4mo ago
no
reflectronic
reflectronic4mo ago
the "Create a Hello World app" will teach you what you need to do to make it work
Crunchy
CrunchyOP4mo ago
im switching to python to cs this is much more complicated
CoRoys
CoRoys4mo ago
Download VS Studio and create a project from a template No need to pressure yourself into the dotnet command line right now
reflectronic
reflectronic4mo ago
there is no command line in the linked directions
Crunchy
CrunchyOP4mo ago
I figured out ,dot net project got hello world line working
Crunchy
CrunchyOP4mo ago
\
No description
Crunchy
CrunchyOP4mo ago
why is this yellow?
No description
Crunchy
CrunchyOP4mo ago
No description
CoRoys
CoRoys4mo ago
C# supports nullability analysis That means you'll get feedback on where Intellisense (i.e code analysis) thinks a null reference exception might happen You can still compile and build, but the code analysis is telling you that you should handle the case when ageInput is null
string? ageInput = Console.ReadLine();

if(ageInput is null)
{

// handle no age input

}
string? ageInput = Console.ReadLine();

if(ageInput is null)
{

// handle no age input

}
Crunchy
CrunchyOP4mo ago
No description
Crunchy
CrunchyOP4mo ago
heres another way i found instead of string i used int
CoRoys
CoRoys4mo ago
This will just output zero if no age was found You should convert the string to an int after you've checked that the string is not null in the first place
Crunchy
CrunchyOP4mo ago
i see
Crunchy
CrunchyOP4mo ago
whats the point in string? ageInput
No description
CoRoys
CoRoys4mo ago
The ? next to string simply converts it to a nullable string
Crunchy
CrunchyOP4mo ago
ah
CoRoys
CoRoys4mo ago
No description
CoRoys
CoRoys4mo ago
You're basically matching your variable type with the return type of the ReadLine function, hence disabling the warning Next time just use var
Salman
Salman4mo ago
instead of Convert functions you can use this as well:
c#
int age = int.Parse(Console.ReadLine());
c#
int age = int.Parse(Console.ReadLine());
if there's a possiblity of null you can also use int.TryParse(value,out int output) , for more info refer to the official documentation this is the modern approach
Crunchy
CrunchyOP4mo ago
also In Cs how to i do print line for multiple lines i know in python we used \n\n
CoRoys
CoRoys4mo ago
This question can be answered by a quick Google search
Crunchy
CrunchyOP4mo ago
i did
No description
Crunchy
CrunchyOP4mo ago
ill try this
CoRoys
CoRoys4mo ago
You don't wanna replace though
Salman
Salman4mo ago
Console.WriteLine("hey");
c#
string x = "some text \n new line will start from here \n and another line" ;
c#
string x = "some text \n new line will start from here \n and another line" ;
$helloworld
Salman
Salman4mo ago
better follow the official guide for more
Crunchy
CrunchyOP4mo ago
i founda goodf method i like
Crunchy
CrunchyOP4mo ago
No description
Crunchy
CrunchyOP4mo ago
but anyways thanks for the help ill go watch youtube videos
reflectronic
reflectronic4mo ago
$helloworld may help
Want results from more Discord servers?
Add your server