▲ 628 ▼ why not a,b or x,y? (lemm.ee) submitted 3 years ago by mastermind@lemm.ee to c/programmerhumor@lemmy.ml 98 comments fedilink hide all child comments
[–] mlc894@lemm.ee 0 points 3 years ago (4 children) Is it for “index” or “iterator”? permalink fedilink source parent hideshow 4 child comments replies: [–] Darohan@lemmy.sdf.org [B] 2 points 3 years ago yes permalink fedilink source parent [–] MyNameIsRichard@lemmy.ml 2 points 3 years ago (1 child) index and jindex permalink fedilink source parent hideshow 1 child comment replies: [–] jalda@sopuli.xyz 1 point 3 years ago jndex permalink fedilink source parent [–] soloner@lemmy.world 1 point 3 years ago I believe index for the classical need to iterate through an array. E.g. for (i = 0; I <= arr.length; i++) { var thing = arr[i] ... } So to me it stands for "index" for array lookup. Before map and iterators were implemented in a lot of languages, this was the defacto way to iterate a list. At least this is how I learned it in java/c back in the day. Nowadays I think most OOP languages including java have implemented the "for ... in ..." Syntax or similar which deprecates this convention. permalink fedilink source parent
[–] MyNameIsRichard@lemmy.ml 2 points 3 years ago (1 child) index and jindex permalink fedilink source parent hideshow 1 child comment replies: [–] jalda@sopuli.xyz 1 point 3 years ago jndex permalink fedilink source parent
[–] soloner@lemmy.world 1 point 3 years ago I believe index for the classical need to iterate through an array. E.g. for (i = 0; I <= arr.length; i++) { var thing = arr[i] ... } So to me it stands for "index" for array lookup. Before map and iterators were implemented in a lot of languages, this was the defacto way to iterate a list. At least this is how I learned it in java/c back in the day. Nowadays I think most OOP languages including java have implemented the "for ... in ..." Syntax or similar which deprecates this convention. permalink fedilink source parent