Am I Learning C# Correctly After Four Days?

August 16, 2026 2 answers
Asked by lentil lunch
I've been learning C# for about four days and wrote this small health-point example. The method changes hp by a given amount, and if health reaches zero it calls Banish(), which sets hp to zero: int hp = 10000; public void HpChange(int howMuch) { hp += howMuch; if (hp <= 0) { Banish(); } else { hp = hp; } } public void Banish() { hp = 0; } I'm still typing on a phone, so apologies for formatting issues. Is this reasonable for someone four days into learning? Is programming mostly about carefully getting lots of small details right, and what are some effective ways to learn faster?

Answers

SquareDeal
For four days in, this is a perfectly reasonable exercise. Youโ€™re using a variable, a method parameter, arithmetic, and an if statement. The `else` block doesnโ€™t do anything, thoughโ€”`hp = hp` leaves the value unchanged, so you can remove it. Also, C# is normally pronounced โ€œC-sharp,โ€ even though the symbol is often called a hash in other contexts.

lentil lunch: Iโ€™ve mostly been learning by reading, and Iโ€™ve always thought of # as hash. Iโ€™ll try to get used to the usual pronunciation.

Reply to this answer
porch_17
Programming does involve being precise, but itโ€™s not just about punctuation. Focus on understanding what each line does and practice by building tiny programs you can test. For this example, try different positive, negative, and zero values for `howMuch` and check whether the result matches what you expect. A keyboard would make writing and formatting code much easier, although you can still study concepts on a phone for now.

lentil lunch: I donโ€™t currently have access to a keyboard, but Iโ€™ll keep practicing with small examples and testing different inputs.

Reply to this answer

Add your answer

Answers are reviewed before publication.

Related Discussions