Skip to content

Instantly share code, notes, and snippets.

View keraf's full-sized avatar

Rafael Keramidas keraf

View GitHub Profile
@keraf
keraf / Hangman.md
Last active March 16, 2025 00:38
Simple hangman game written in C# (.NET 6). This was done as an example for a friend who's learning programming.

Hangman

This is a simple hangman game written in C# (.NET 6). This was done as an example for a friend who's learning programming. Hopefully this can be useful to others as well.

How it works

  1. A word is selected from the list of words (value assigned to choosenWord).
  2. We initialize an empty array that will contain all the letters that have been submitted. This array is called letters.
  3. We also store a count of how many lives are left. This variable is called lives.
  4. The main game loop runs as long as the lives have not reached 0.
  5. Inside the loop, the following happens:
  6. We loop through each letter of the choosen word.