How to learn coding
Programming is a lot like mathematics in the sense that logical thinking is required and also abstract thinking is important. So it is logical to assume that learning coding can be approached in the same way as learning mathematics. Mathematics is taught through doing exercises and seeing examples with the help of a teacher and a book to study. This happens from kindergarten, through highschool, all the way to University. On most schools coding is not taught but it is often possible to join an interest group. After high school you can study computer science at a university.
Wait. I hear you thinking. I missed all these opportunities but I still want to learn. Luckily, since a school is only a helping facility, you can still learn by using other helping resouces. I still think it is good to start with a book and do some exercises listed in the book. Preferably, exercises with answers so you can check it. Now there is no teacher available but you can use a forum to ask questions about unclear things. The downside of learning by yourself is that nobody is forcing you to do exercises and study theory. So in order to motivate yourself you need a goal to work towards. So my recommendation is to do some plain studying from a book and mix that up with small projects that will help you with your goal. A youtube video detailing the Techlead story for learning and also recommends project based learning can be found here
The previous part detailed mostly traditional ways but these days there are many online opportunities. For instance there are online courses at sites like Coursera, Udemy and PluralSight. You can find tutorials on websites and videos about various programming topics on Youtube. Even lectures from famous universities can be found there. There are websites where you can try out writing code in the browser and run it with the click of a mouse. There is interactive documentation using jupyter notebooks, for c# there is the try documentation now. Also there are several coding games, where you need to code to solve puzzles. There's competitive programming to test algorithms knowledge.
Start doing and also look at other peoples code. There are many opensource projects to look at. I would try to find some simple ones as the bigger projects can be a bit overwhelming and require different types of code to be used by multiple people.