Tutorial by Examples: editer

The special LOOP NAMED foo syntax allows you to create a loop that you can exit early from. The exit is performed using return-from, and can be used from within nested loops. The following uses a nested loop to look for a complex number in a 2D array: (loop named top for x from 0 below (arr...
A common pattern in other languages is having a function that produces a "stream" of objects, and being able to use loop-code to loop over it. We can model this in C++ as template<class T> struct generator_iterator { using difference_type=std::ptrdiff_t; using value_type=T; ...

Page 1 of 1