DEV Community

Discussion on: Meme Monday

Collapse
 
kapaseker profile image
PangoSea

any language's arrays begin at 1?

Collapse
 
lexlohr profile image
Alex Lohr

Lua.

Thread Thread
 
kapaseker profile image
PangoSea

aha, that is really fun

Collapse
 
fyodorio profile image
Fyodor

Lua

Collapse
 
darkwiiplayer profile image
𒎏Wii 🏳️‍⚧️ • Edited

Lua "arrays"* begin at 1

* Lua doesn't really have "arrays", but sequences are functionally the same thing, and those start at 1

Collapse
 
best_codes profile image
Best Codes

Image description

Collapse
 
nlxdodge profile image
NLxDoDge

In java you can do something like this:

var shoppingList = new ArrayList<String>();
shoppingList.add("Milk");
System.out.println(shoppingList.get(0));
Enter fullscreen mode Exit fullscreen mode

That would print milk as far as I know. And if you pseudocode this up to other languages it will (for most) also work the same. It only depends if the implementation starts at 0 or 1.

Collapse
 
alexmario74 profile image
Mario Santini

smalltak

Thread Thread
 
kapaseker profile image
PangoSea

sounds like small talk.

Collapse
 
russellbateman profile image
Russell Bateman

Pascal's did as I recall, but it's been over 40 years now.