For context, I have couple repositories on github, some of which showcase solutions to course projects or homeworks, while others - are created "for fun" (for example implementation of tail
command in Python). They're by no means "high-grade" examples of code. There's no intent to distribute code in those repositories for commercial or non-commercial use. The entire goal is to just show to others what I've done.
According to Wikipedia definition,
[a] software license is a legal instrument (usually by way of contract law, with or without printed material) governing the use or redistribution of software.
So this reads to me that even if I don't intend to distribute my software for others to use, if someone does copy it off the repository and uses it, I may want to add a license to explicitly state what I am OK with and not OK with the licensee doing.
At the same time, github states:
You're under no obligation to choose a license. However, without a license, the default copyright laws apply, meaning that you retain all rights to your source code and no one may reproduce, distribute, or create derivative works from your work.
This by contrast seems to imply that I can showcase my code just fine, but if someone copies the code to try it out, they're therefore breaking copyright law (which kinda sounds like "look but don't touch").
Hence the question, for code that is intended to be showcased and not necessarily distributed or used by others, does the code still have to be licensed in some way, shape, or form ?