done
done(iter, state) -> Bool
Test whether we are done iterating
Examples
"""
done(iter, state) -> Bool
Test whether we are done iterating.
# Arguments
- `iter`: The iterator to check for completion.
- `state`: The current state of iteration.
# Returns
- `Bool`: `true` if iteration is complete, `false` otherwise.
# Examples
```julia
julia> iter = 1:5;
julia> state = 3;
julia> done(iter, state)
false
This example checks if the iteration using the iter
iterator is complete based on the state
value.
julia> iter = [true, true, false];
julia> state = 2;
julia> done(iter, state)
true
In this example, the done
function returns true
as the iteration is complete based on the state
value.
Common mistake example:
julia> iter = 1:5;
julia> state = 7;
julia> done(iter, state)
ERROR: BoundsError: attempt to access 5-element UnitRange{Int64} at index [7]
Here, an error occurs because the state
value is out of bounds for the given iterator. Make sure the state
value is within the valid range of the iterator before using done
.
"""
function done(iter, state)
Implementation code goes here
end
See Also
countfrom, cycle, done, drop, eachindex, enumerate, first, repeated, rest, start, svds, take, vecdot, vecnorm, zip,User Contributed Notes
Add a Note
The format of note supported is markdown, use triple backtick to start and end a code block.