MathGroup Archive 2010

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: How do I test for existence of a list element?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg112683] Re: How do I test for existence of a list element?
  • From: Helen Read <hpr at together.net>
  • Date: Sun, 26 Sep 2010 02:45:06 -0400 (EDT)
  • References: <i7k4d7$lha$1@smc.vnet.net>
  • Reply-to: HPR <read at math.uvm.edu>

On 9/25/2010 2:21 AM, Joseph Gwinn wrote:
> I have an application where I am bouncing around in a list, and may
> accidentally ask for an element beyond the end of the list, which causes
> Mathematica to complain and balk, preventing completion.
>
> Is there any way to test for the existence of a list element without
> provoking complaint or balking should the list item fail to exist?

Why not ask for the Length[list]  ?

-- 
Helen Read
University of Vermont


  • Prev by Date: Re: Convex crossover in genetic algorithm
  • Next by Date: Re: calculate the area
  • Previous by thread: How do I test for existence of a list element?
  • Next by thread: Re: How do I test for existence of a list element?