C
C#3mo ago
Crunchy

✅ how to start

help
No description
41 Replies
Crunchy
Crunchy3mo ago
in VSC im trying to make a symbol thing to start out wiuth i get this issue when clicking f5
Crunchy
Crunchy3mo ago
No description
Crunchy
Crunchy3mo ago
No description
Crunchy
Crunchy3mo ago
No description
Crunchy
Crunchy3mo ago
i have both of these installed
reflectronic
reflectronic3mo ago
you need to make a project you can't just have a .cs file
Crunchy
Crunchy3mo ago
SO i need to use community version?
reflectronic
reflectronic3mo ago
no
reflectronic
reflectronic3mo ago
the "Create a Hello World app" will teach you what you need to do to make it work
Crunchy
Crunchy3mo ago
im switching to python to cs this is much more complicated
CoRoys
CoRoys3mo ago
Download VS Studio and create a project from a template No need to pressure yourself into the dotnet command line right now
reflectronic
reflectronic3mo ago
there is no command line in the linked directions
Crunchy
Crunchy3mo ago
I figured out ,dot net project got hello world line working
Crunchy
Crunchy3mo ago
\
No description
Crunchy
Crunchy3mo ago
why is this yellow?
No description
Crunchy
Crunchy3mo ago
No description
CoRoys
CoRoys3mo 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
Crunchy3mo ago
No description
Crunchy
Crunchy3mo ago
heres another way i found instead of string i used int
CoRoys
CoRoys3mo 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
Crunchy3mo ago
i see
Crunchy
Crunchy3mo ago
whats the point in string? ageInput
No description
CoRoys
CoRoys3mo ago
The ? next to string simply converts it to a nullable string
Crunchy
Crunchy3mo ago
ah
CoRoys
CoRoys3mo ago
No description
CoRoys
CoRoys3mo 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
Salman3mo 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
Crunchy3mo ago
also In Cs how to i do print line for multiple lines i know in python we used \n\n
CoRoys
CoRoys3mo ago
This question can be answered by a quick Google search
Crunchy
Crunchy3mo ago
i did
No description
Crunchy
Crunchy3mo ago
ill try this
CoRoys
CoRoys3mo ago
You don't wanna replace though
Salman
Salman3mo 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
Salman3mo ago
better follow the official guide for more
Crunchy
Crunchy3mo ago
i founda goodf method i like
Crunchy
Crunchy3mo ago
No description
Crunchy
Crunchy3mo ago
but anyways thanks for the help ill go watch youtube videos
reflectronic
reflectronic3mo ago
$helloworld may help
Want results from more Discord servers?
Add your server