7 kyu

Last

974 of 8,815xcthulhu

Description:

Find the last element of the given argument(s). If a single argument is passed and is a list/array or a string, return its last element. It is guaranteed that there will be at least one argument and that single-argument arrays/lists/strings will not be empty.

Examples

last [1, 2, 3, 4]     -- =>  4
last ['x', 'y', 'z']  -- => 'z'
(last [1, 2, 3, 4]) ; => 4
(last "xyz")        ; => \z
last(Arrays.asList(1, 2, 3, 4)); // =>  4
last("xyz");                     // => "z"
last(1, 2, 3, 4);                // =>  4
last(new int[]{1, 2, 3, 4});     // =>  4
last(&[1, 2, 3, 4])     // =>  4
last(&['x', 'y', 'z'])  // => 'z'

(courtesy of haskell.org)

Lists
Fundamentals

Stats:

CreatedSep 14, 2014
PublishedSep 14, 2014
Warriors Trained15771
Total Skips814
Total Code Submissions81889
Total Times Completed8815
Haskell Completions974
Clojure Completions669
JavaScript Completions3725
Ruby Completions709
CoffeeScript Completions64
Python Completions1902
Rust Completions636
Java Completions883
Total Stars183
% of votes with a positive feedback rating77% of 1066
Total "Very Satisfied" Votes709
Total "Somewhat Satisfied" Votes219
Total "Not Satisfied" Votes138
Ad
Contributors
  • xcthulhu Avatar
  • jhoffner Avatar
  • Abbe Avatar
  • bekh6ex Avatar
  • brianweiser Avatar
  • ZozoFouchtra Avatar
  • GiacomoSorbi Avatar
  • shadowmanos Avatar
  • anter69 Avatar
  • Voile Avatar
  • Madjosz Avatar
  • trashy_incel Avatar
  • KayleighWasTaken Avatar
  • saudiGuy Avatar
Ad