Posted
hello welcome to c# lesson 1 of this sieries i guess idk lets get started
VARIABLES
Variables store a value. These values can be ints, strings, doubles, floats, chars, bytes, and more.
TO DECLARE A VARIABLE
//these are comments. anything starting with "//" is a comment and will not affect your code. these are used to explain what your code is doing.
//data type - name - value
int stuff = 0;
//in this example, the data type is int which stores whole numbers. The name of the variable is "stuff" and the value is 0. You don't have to assign a value but it's probably a bad idea.
int stuff;
stuff = 0;
//example of not assigning a value
There is also the var keyword which automatically assumes the data type. You however can't use var for things such as class scoped variables.
FUNCTIONS
Functions are how you do things in C#. You can declare a function like this.
// To declare functions, start with public/static (I shall get into this at a later time and also is optional) followed by the return type. You can return things such as computed values or whatever through functions.
void myFunction(int arg)
{
Console.WriteLine(arg);
}
//Example of returning something
bool isEven(int num)
{
return num % 2 == 0;
}
This is all you shall require for basic C#. You will have already learned this or have just learned this. This is extremely basic and i shall go into further topics in replies if you want.
"Questionable intellegence, but I like the mystery" - CubeFaces
https://cdn.discordapp.com/attachments/1136067487847415848/1138948596679589898/sig.png
Replied
Can someone make something like this for C++
It would be REALLY helpful for me as I'm a beginner in it.
Cancel
Post
https://media.discordapp.net/attachments/994643402949926956/1004560140252495960/uqJXQIda.gif
Discord: Ad#1085; Don't hesitate to DM me if you need help/anything.
Replied
Dann you put alot of effort into this, nice job
Cancel
Post
Did I mention I use arch btw?
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post