Skip to content

Commit

Permalink
Create Shorts “2024-10-02-programming-tip/index”
Browse files Browse the repository at this point in the history
  • Loading branch information
elpachongco committed Oct 2, 2024
1 parent acc690c commit 812c09c
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions content/shorts/2024-10-02-programming-tip/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Programming tip
date: 2024-10-02T09:00:00.000+08:00
draft: false
featured: false
---
Programming tip: differentiate indexes and counts in code.
Index starts at 0, count starts at 1.
Count is also equal to array length.
In python, one can do this
```py
for count, fruit in enumrate(fruits, start=1):
```
This has saved me a lot of confusion.

0 comments on commit 812c09c

Please sign in to comment.