
% find the last element of a list

% if the list has only one element
%    then that is the last
findLast([E], E).

% otherwise call recursively on the tail of the list
findLast([_H|T], E) :- findLast(T, E).

