Copyright by its very nature protects works that involve some level of creative expression. For example, a recipe by itself is not copyrightable because it's a mere recital of steps to create a dish. However, creative expressions that involve a particular recipe is copyrightable.
Examples of creative expressions that involve a recipe:
- Compiling recipes and presenting them into a cookbook. The layout, photographs, comments, font selection, color scheme, and any creative expressions within the cookbook are copyrightable elements.
- Creating a youtube video of yourself creating the dish based on the recipe. This includes narratives, footage, music selection, and other creative expressions of the creator of the video.
- Selling the food you make from the recipe, however, is not a copyrightable act. There is nothing stopping you from opening a restaurant using a recipe you follow from YouTube.
I'm going to present a scenario where following the tutorial might actually be infringing on a copyright: suppose you are following a tutorial made by a famous art forger by the name of Neal Caffrey, and you just created a perfect replica of a famous artist's painting that is known to be a registered, copyrighted art masterpiece.
If you use it to learn the artist's art style, and use it merely for your personal educational benefit, you still technically infringe the artist's copyright. However, you can raise the fair use defense and have a good chance of winning a copyright infringement suit.
On the other hand, if you use the tutorial to create de facto forgeries of the art piece, and sell it on the black market, not only are you committing copyright infringement, but you are also committing potential fraud by selling an imitation of someone else's work of art.
Extreme examples aside, just look at what are you planning to do with the tutorial code. Review the license carefully. Most professionally made tutorial code base have clear cut licensing terms, and as long as you're not literally copy pasting the code for commercial use, you should be fine.
Ethically and professionally speaking, it is always best to create your own implementation of a given code, applying what you learned from the other code. In my experience, writing your own code actually will not only make you a better programmer, but you might discover unintentional errors or limitations that you would not otherwise discovered had you not written the code yourself.
10 ? "Hello World"
20 GOTO 10