Why did you use variables like ‘i’ or ‘j’ in for loop instead of verbose names like “counter”? 👨🏽💻
Conversation
Notices
-
nixCraft 🐧 (nixcraft@mastodon.social)'s status on Thursday, 12-Sep-2024 09:13:08 JST nixCraft 🐧 -
Tertle950 (tertle950@mastodon.social)'s status on Thursday, 12-Sep-2024 09:13:50 JST Tertle950 @nixCraft my monitor only has so much space dude
-
Will (willa763@mastodon.social)'s status on Thursday, 12-Sep-2024 09:17:47 JST Will @nixCraft Depends on how clear that variable is for me to use something like counter.
-
Seth Galitzer (sgsax@mastodon.social)'s status on Thursday, 12-Sep-2024 09:18:09 JST Seth Galitzer @nixCraft Remember when we used to write concise and clear code, economizing as much as possible, looking for the most elegant and compact solution? I miss those days.
-
lemgandi (lemgandi@mastodon.social)'s status on Thursday, 12-Sep-2024 09:19:51 JST lemgandi @nixCraft Actually I favor "ii" and "jj". Much easier to search for in a text editor.
-
selje 🇺🇸 🇺🇦 🇳🇴 🇮🇪 (selje@mastodon.social)'s status on Thursday, 12-Sep-2024 09:20:52 JST selje 🇺🇸 🇺🇦 🇳🇴 🇮🇪 @nixCraft
Because many of us started programming in the days of monochrome monitors and no mouse. Similar to why some many standard Unix cli commands are two to three letters, ls, ed, pwd, etc. -
Tom Lyon ✅ (aka_pugs@mastodon.social)'s status on Thursday, 12-Sep-2024 09:23:15 JST Tom Lyon ✅ @nixCraft FORTRAN did it first, but it comes straight from math notation for sums (big sigma) and products (big pi). Do people really not realize this?
-
Jonathan M. (hstone32@mastodon.social)'s status on Thursday, 12-Sep-2024 10:17:41 JST Jonathan M. @nixCraft because my math classes taught me to identify dimensions as I, j, k, l
-
Epistomai (epistomai@mastodon.social)'s status on Thursday, 12-Sep-2024 13:41:36 JST Epistomai @nixCraft, if it's for a quick for, I use them. if it's more complex, or I will need the variable for later, then another more specific
-
expiredtoken (expiredtoken@mastodon.social)'s status on Thursday, 12-Sep-2024 14:33:47 JST expiredtoken @nixCraft We had an argument about variable names in loops, and i won. Period.
-
Freevolt (freevolt24@mastodon.social)'s status on Thursday, 12-Sep-2024 17:02:33 JST Freevolt @nixCraft because its... verbose
-
Mike Seymour (mikeseymour@mastodon.social)'s status on Thursday, 12-Sep-2024 20:40:34 JST Mike Seymour @nixCraft it's a long-standing and well understood convention, adopted from mathematics by the earliest programming languages, and can help keep expressions short and readable. Simply using a longer name like "counter" gives no useful information, but sometimes it's helpful to use a more descriptive name to better specify what you're iterating over. Choosing good names is a difficult and context-sensitive problem.
-
Florian Xaver (wosrediinanatour@mastodon.social)'s status on Friday, 13-Sep-2024 04:34:07 JST Florian Xaver @nixCraft I guess it comes from indices in Mathematics.
-