Iterator Name Generator

Loop variables, cursors and iterator class names

Technology & Internet500 curated namesUpdated Free · no sign-up

Tap a name to copy it500 names in this generator

Get idiomatic iterator names for real code: loop counters, cursor and index variables, and iterator class names like PeekableIterator or ChunkedIterator that follow Python, Java, Rust, C++ and JavaScript conventions.

About iterator names

Iterator names in code follow strong conventions, and breaking them costs readability. The single letters i, j and k for nested loop counters date back to Fortran, where variables starting with I through N were integers by default; they are still the expected names for a plain index in almost every language. Once the loop body grows or the variable escapes the loop, a descriptive noun is better: row and col for grids, node for trees, cursor for database rows, tok for tokens, and elem or item for a generic element.

Iterator types and classes have their own vocabulary. C++ distinguishes InputIterator, ForwardIterator, BidirectionalIterator and RandomAccessIterator by capability. Rust's standard library names adapters after the operation they perform: Zip, Chain, Peekable, StepBy, Chunks, Windows, Rev, Fuse, IntoIter and IterMut. Java uses Iterator, ListIterator and Spliterator, while Python leans on generators and itertools names such as chain, cycle, groupby, islice and pairwise. JavaScript adds AsyncIterator and AsyncGenerator for streams.

A good iterator name says what it walks over and how. Prefer the noun of the element for the loop variable (user, order, line), name the collection in the plural (users, orders, lines), and reserve i, j, k for short numeric loops. Class names should end in Iterator, Iter, Cursor or Walker and lead with the transformation or data structure they cover.

Tips for choosing a name

  • Use i, j, k only for short numeric loops of a few lines; if you need to read the loop later, switch to a noun such as row, col, node or item.
  • Name the loop variable as the singular of the collection: for user in users, for line in lines, for entry in entries. This makes off-by-one bugs and shadowing much easier to spot.
  • For iterator classes, follow your language's library: end in Iterator in Java and C++, Iter or IntoIter in Rust, and use adapter verbs like Peekable, Chunked or Zip to describe the transformation.
  • Avoid it, iter and cur when two iterators are live at once; use src and dst, left and right, or lhs and rhs so the reader can tell them apart.
  • Reserve cursor for stateful, resumable iteration such as database result sets or paged APIs, and walker for tree, graph and directory traversal.

Frequently asked questions

Why are loop counters called i, j and k?

The habit comes from early Fortran, where variables beginning with the letters I to N were implicitly integers, and from mathematics, where i, j and k are the standard subscripts for indices. Nested loops naturally continue the alphabet with j and k.

What should I name an iterator variable instead of it or iter?

Name it after what it points to: node for a linked list, entry for a map, tok for a tokenizer, row for a result set. If two iterators are active at once, use src and dst or lhs and rhs so they are never confused.

How are iterator classes usually named?

Most languages use a Type + Iterator pattern (ListIterator, TreeIterator, ChunkIterator) or an adapter noun such as Peekable, Zip, Chain and Windows in Rust. C++ additionally names iterators by capability, for example ForwardIterator or RandomAccessIterator.

Is it bad practice to reuse the same iterator name in nested loops?

Yes. Reusing i for both an outer and inner loop causes shadowing bugs and confuses readers. Use i and j, or better, descriptive names such as row and col, so each level of nesting is unambiguous.

All 500 iterator names

Browse the full list
  • i
  • j
  • k
  • n
  • idx
  • index
  • ix
  • pos
  • cursor
  • cur
  • current
  • curr
  • it
  • iter
  • iterator
  • walker
  • ptr
  • node
  • elem
  • element
  • item
  • entry
  • row
  • col
  • line
  • token
  • chunk
  • batch
  • page
  • pair
  • kv
  • key
  • value
  • val
  • head
  • tail
  • next
  • prev
  • first
  • last
  • begin
  • end
  • start
  • stop
  • step
  • stride
  • offset
  • count
  • counter
  • loop
  • pass
  • round
  • tick
  • frame
  • epoch
  • iteration
  • seq
  • src
  • dst
  • left
  • right
  • lo
  • hi
  • mid
  • lhs
  • rhs
  • outer
  • inner
  • parent
  • child
  • sibling
  • leaf
  • edge
  • vertex
  • neighbor
  • cell
  • slot
  • bucket
  • shard
  • record
  • doc
  • msg
  • event
  • task
  • job
  • op
  • cmd
  • arg
  • param
  • field
  • prop
  • attr
  • ch
  • byte
  • word
  • bit
  • sample
  • point
  • x
  • y
  • z
  • line_no
  • user
  • order
  • Iterable
  • IntoIterator
  • Enumerator
  • Generator
  • Visitor
  • Traverser
  • Scanner
  • Tokenizer
  • Lexer
  • Reader
  • Stream
  • Range
  • Span
  • Slice
  • View
  • Window
  • Sequence
  • ListIterator
  • ArrayIterator
  • MapIterator
  • SetIterator
  • KeyIterator
  • ValueIterator
  • EntryIterator
  • RangeIterator
  • ChunkIterator
  • ChunkedIterator
  • WindowIterator
  • SlidingWindow
  • BatchIterator
  • PagedIterator
  • LazyIterator
  • PeekableIterator
  • BufferedIterator
  • FilterIterator
  • FlatMapIterator
  • ZipIterator
  • ChainIterator
  • CycleIterator
  • TakeIterator
  • SkipIterator
  • ReverseIterator
  • BidirectionalIterator
  • RandomAccessIterator
  • ForwardIterator
  • TreeIterator
  • PreorderIterator
  • InorderIterator
  • PostorderIterator
  • LevelOrderIterator
  • BreadthFirstIterator
  • DepthFirstIterator
  • GraphWalker
  • DirWalker
  • LineIterator
  • ByteIterator
  • CharIterator
  • TokenStream
  • EventStream
  • RecordCursor
  • RowCursor
  • ResultSetIterator
  • QueryCursor
  • AsyncIterator
  • AsyncGenerator
  • CountingIterator
  • IndexedIterator
  • SortedIterator
  • MergeIterator
  • IntersectionIterator
  • DedupIterator
  • UniqueIterator
  • GroupByIterator
  • SplitIterator
  • ProductIterator
  • PermutationIterator
  • CombinationIterator
  • MatrixIterator
  • RowIterator
  • ColumnIterator
  • GridWalker
  • PixelIterator
  • SampleIterator
  • FrameIterator
  • RetryIterator
  • ii
  • jj
  • kk
  • nn
  • ci
  • cj
  • ri
  • rj
  • di
  • dj
  • xi
  • yi
  • i0
  • i1
  • j0
  • j1
  • n0
  • n1
  • ndx
  • row_idx
  • col_idx
  • elem_idx
  • item_idx
  • byte_idx
  • char_idx
  • line_idx
  • batch_idx
  • chunk_idx
  • seq_no
  • seq_num
  • row_no
  • page_no
  • frame_no
  • iter_no
  • loop_idx
  • loop_i
  • loop_j
  • inner_i
  • outer_i
  • lvl
  • depth
  • level
  • rank
  • ord
  • ordinal
  • nth
  • kth
  • ith
  • jth
  • pivot
  • median
  • lower
  • upper
  • low
  • high
  • floor
  • ceil
  • top
  • bottom
  • front
  • back
  • before
  • after
  • peek
  • peeked
  • lookahead
  • ahead
  • behind
  • remaining
  • rest
  • remainder
  • leftover
  • done
  • exhausted
  • finished
  • has_next
  • hasNext
  • has_more
  • more
  • yielded
  • emitted
  • produced
  • consumed
  • seen
  • visited
  • pending
  • queued
  • current_node
  • curr_node
  • next_node
  • prev_node
  • next_item
  • last_seen
  • head_ptr
  • tail_ptr
  • read_ptr
  • write_ptr
  • end_ptr
  • begin_it
  • end_it
  • rit
  • cit
  • crit
  • subiter
  • inner_it
  • outer_it
  • child_it
  • parent_it
  • elt
  • el
  • itm
  • obj
  • rec
  • tup
  • tuple
  • kvp
  • sub
  • part
  • piece
  • segment
  • section
  • block
  • tile
  • patch
  • region
  • zone
  • lane
  • column
  • rownum
  • colnum
  • lineno
  • linenum
  • charno
  • tokno
  • pageno
  • seqno
  • recno
  • docno
  • uid
  • oid
  • pid
  • tid
  • rid
  • gid
  • k1
  • k2
  • v1
  • v2
  • e1
  • e2
  • n2
  • x0
  • x1
  • y0
  • y1
  • dx
  • dy
  • dz
  • ix0
  • iy0
  • xs
  • ys
  • zs
  • row_iter
  • line_iter
  • char_iter
  • kv_iter
  • chunk_iter
  • file_iter
  • dir_iter
  • walk
  • crawl
  • crawler
  • scan
  • probe
  • sweep
  • sweeper
  • stepper
  • tracker
  • marker
  • pointer
  • handle
  • ref
  • cell_ref
  • IterMut
  • IntoIter
  • Drain
  • Chars
  • Bytes
  • Lines
  • Split
  • SplitWhitespace
  • Chunks
  • ChunksExact
  • Windows
  • Zip
  • Chain
  • Cycle
  • Rev
  • Fuse
  • Peekable
  • StepBy
  • Take
  • TakeWhile
  • Skip
  • SkipWhile
  • Filter
  • FilterMap
  • FlatMap
  • Flatten
  • Map
  • Inspect
  • Enumerate
  • Repeat
  • RepeatWith
  • Once
  • Empty
  • FromFn
  • Successors
  • enumerate_idx
  • loop_var
  • loop_counter
  • iter_count
  • num_iters
  • max_iter
  • n_iter
  • retries
  • attempt
  • attempts
  • tries
  • generation
  • gen
  • pass_no
  • sweep_no
  • round_no
  • turn
  • tick_count
  • elapsed
  • cursor_pos
  • read_pos
  • write_pos
  • scan_pos
  • seek_pos
  • byte_offset
  • bit_offset
  • char_offset
  • line_offset
  • base_idx
  • rel_idx
  • abs_idx
  • global_idx
  • local_idx
  • flat_idx
  • linear_idx
  • grid_idx
  • tile_idx
  • block_idx
  • thread_idx
  • worker_id
  • partition
  • segment_id
  • window_start
  • window_end
  • chunk_start
  • chunk_end
  • range_start
  • range_end
  • lower_bound
  • upper_bound
  • lbound
  • ubound
  • slow
  • fast
  • tortoise
  • hare
  • runner
  • probe_idx
  • sentinel
  • anchor
  • watermark
  • checkpoint
  • frontier
  • horizon
  • boundary
  • scanline
  • kernel_x
  • kernel_y
  • neighbor_idx
  • adjacent
  • succ
  • pred
  • ancestor
  • descendant
  • subtree
  • branch
  • level_nodes
  • queue_front
  • stack_top
  • top_of_stack
  • visited_set
  • work_item
  • current_batch
  • next_batch
  • current_page
  • next_page
  • page_token
  • continuation_token
  • resume_token
  • next_cursor
  • end_cursor
  • has_prev

More in Technology & Internet