Patterns in output can help build logic.

Photo by Bram Naus on Unsplash

Patterns in output can help build logic.

How does it work is a constant question anyone starting will ask. Let's talk about it.

*****

****

***

**

Above simple program tells that the difference between first and second line is just a * and same between third and second and also between fourth and third.

Once you understand what is changing and the pattern in it. You can find a way to model it with syntax and get the desired output.

Sometimes we need to go from A to E but one logic works only from A to B and other works from D to E.

So we need to find how to go from B to D.

The whole process of logic formation is to continually ask

  1. What do I need to have?
  2. What options do I have?
  3. How do I get from input to output?
  4. What limitations can this have? How do I handle this error?

Once you start asking questions you will find a way to form a logic and your program will be complete when all logics work on their own. They don't need any more intervention to correct them.

Try, build and watch how things are working under the hood logically. It helps to remember and solve next time.