Variables are an essential part of any programming language. Variables allow you to store and manipulate data during the execution of your code.
In this post I will be writing about the built-in types in the C# language. These are known as integral numeric, floating point numeric, bool, and char. The aspects to these variables are declarations, initialization, scope, assignment, and modification.
char firstLetter = 'a';
int age = 33;
double cost = 1337.00;
bool isOpen = false;
In the example above I have declared and initialized the four simple type variables in C#. It starts with first defining the type the variable will be, naming the variable, and assigning a value to the variable. You don't always need to assign a value to the variable upon declaring the variable.
char firstLetter;
int age;
double cost;
bool isOpen;
In the examples above I have described how to define, initialize, and assign variables in C#. I have recently started a blog to help jot down my programming education / learnings that I have picked up over the last five years. I go more in depth on modification and scope of variables in C# in the latest post published today. If you are interested check it out.
My blog: https://kylemartin0819.wordpress.com/
I plan on creating concise, short read, lessons here on Dev.to that summarize my blog posts as well so consider giving me a like and follow. Check out my GitHub where I have been storing C# code from online courses / books I have been digesting recently.
Thanks for reading!
Kyle
Top comments (0)