- Ada
- C
- Clojure
- Clojure
- C++
- C++
- C#
- C#
- C#
- D
- D
- Dart
- Elixir
- Erlang
- Fortran
- Go
- Groovy
- Haskell
- Haskell
- JS
- JS
- Java
- Java
- Kotlin
- Lisp
- Lua
- Obj-C
- PHP
- PHP
- Pascal
- Perl
- Perl
- Python
- Ruby
- Ruby
- Rust
- Rust
- Scala
- Scheme
- VB
int[42] items;
int x = items[$-1];
The dollar operator represents the length of the array that's referred to inside the square brackets.
x := items[len(items)-1]
items is a slice.
There is no shortcut, use len!
Panics if the list is empty.
There is no shortcut, use len!
Panics if the list is empty.
programming-idioms.org