LCD pin declaration query

Setting up and 2x16 LCD with Nano.
Most sketches I've seen online have pin declaration looking something like this:-

LiquidCrystal lcd(2,3,4,5,11,12); // Pins D2, D3, D4, D5, D11, D12:
with the pins in ascending order.
I can't get to work.

In a desperation, I used this:-
LiquidCrystal lcd(12,11,5,4,3,2); // Pins D12, D11, D5, D4, D3, D2:
in descending order, and it works!!!

Why is this?

It’s not about the numerical order. It’s about what pins on Arduino you have connected to what pins on the LCD. Each one of those pins is attached to a certain pin on the LCD and they need to go in a certain order.

The first one should be the pin you connected to the RS pin on the LCD. The second one goes to the Enable pin, the third to the sixth are the data lines d0, d1, d2, and d3 on the LCD.

You could connect pin 7 to the rs pin, 4 to the enable pin, 8 to d0, A0 to d1, 2 to d2 and 6 to d3 and then it would look like:

LiquidCrystal lcd(7, 4, 8, A0, 2, 6);

But that would be silly because you’d have wires crossed up all over the place.