Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • Perl
my $N = @x;

I like to be more explicit, using $N = scalar @x; but some people consider that overly verbose.
$n = scalar @x;

This is a recommended way, which ensures that any kind of list is in scalar mode, where only it's size is produced.
with Ada.Containers.Vectors;
use Ada.Containers;
N : Count_Type := X.Length;

New implementation...
< >
programming-idioms.org