Open main menu

CDOT Wiki β

Changes

GPU621/The Chapel Programming Language

129 bytes removed, 13:19, 20 November 2020
Iterators
Chapel implements iterators using a function-like syntax, although the semantic behaviour of an iterator differs from that of a function in some important ways. Unlike functions, instead of returning a value, Chapel iterators typically return a sequence of values. The '''yield''' statement, legal only within iterator bodies, returns a value and temporarily suspends the execution of the code within the iterator.
 
As an example, the following Chapel code defines a trivial iterator that yields the first n values from the Fibonacci sequence:
iterator fibonacci(n): integer {
25
edits