Skip to content

Instantly share code, notes, and snippets.

@JKerens
Created March 9, 2026 23:52
Show Gist options
  • Select an option

  • Save JKerens/cca86bbfcfbc51f73d6a3051e615c338 to your computer and use it in GitHub Desktop.

Select an option

Save JKerens/cca86bbfcfbc51f73d6a3051e615c338 to your computer and use it in GitHub Desktop.
Class Examples
using Basics;
// Similar to Schemas in Pyschology, we need to break concepts apart
// Like Red Ball != Red Apple, now red round things are 2 different concepts
// In programming, we have data types to help us break apart concepts
// "Mary had a little lamb" is a string, 1 + 1 is numbers
// What we do with these values are COMPLETELY different
// This is why some questions might start sounding dumb
// How data types work in C#
// numbers
int addition = 1 + 1; // 2
// words (think quotes means string)
string myName = "Michelle" + "Hanson"; // "MichelleHanson"
string alsoMyName = "Michelle Hanson";
// Why types are important (Quiz)
var whatAmI = "One" + "One";
var whatAmI2 = "1" + "1";
// Just output so we can see the results
Console.WriteLine("Press [Enter] to see the results...");
string fromUser = Console.ReadLine();
Console.WriteLine(whatAmI);
Console.ReadLine();
Console.WriteLine(whatAmI2);
Console.ReadLine();
#region Basics Reference
// Data Types
int number = 1;
int[] numbers = [1, 2, 3, 4, 5];
// Operations act different based on type
int result = number + 1;
// strings are just sentences and words
string name = "Alice";
string greeting = "Hello, " + name;
// Loops
foreach (var item in numbers)
{
Console.WriteLine(item);
}
// Finding things in arrays
List<int> numbersGreaterThan2 = numbers
.Where(n => n > 2)
.ToList();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment