C# Lesson 1
Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.
Author
Characters, the data type that's just a little less useful than a string.
The while statement is simple loop. As long as the condition inside the while() evaluates to true, the section of code will keep repeating itself.
Afterwards you can continue to the next lesson!
Or go back and review the previous lesson.
We also have the source code on GitHub.
using System;
namespace Lesson8
{
class Characters
{
static void Main(string[] args)
{
// b
// 2
// !
// Ñ
Console.OutputEncoding = System.Text.Encoding.UTF8;// Add this last
char myFirstChar = 'Ñ';
Console.WriteLine("Char: " + myFirstChar + " | Int: " + Convert.ToInt32(myFirstChar));
for (int x = 1; x <= 209; x++)
{
char numberToChar = Convert.ToChar(x);
Console.WriteLine($"count {x} : {numberToChar}"); // Show ascii/unicode table after this
}
}
}
}
/*
* TASK:
* Make a for loop that starts at 97 and goes to 122 (includes 122).
* Convert the integer you use for the for loop into a char and print it.
* It will print a lowercase letter.
* Then print the same letter but in uppercase in the same loop.
*
* You can use https://en.wikipedia.org/wiki/List_of_Unicode_characters as a reference.
*/
using System;
namespace Lesson8Task
{
class CharactersTask
{
static void Main(string[] args)
{
}
}
}
We have similar articles. Keep reading!
Learn how to declare and use variables in the very first lesson from our series on learning C# for beginners.
Author
Learn how to read input from the user in the second lesson from our series on learning C# for beginners.
Author
Learn how to do some basic math with C# in the 3rd lesson from our series for beginners learning C#.
Author