Skip to content

Instantly share code, notes, and snippets.

@nikhedonia
Created October 31, 2018 18:43
Show Gist options
  • Save nikhedonia/0aafc2d119bd75a830b520da27347ac4 to your computer and use it in GitHub Desktop.
Save nikhedonia/0aafc2d119bd75a830b520da27347ac4 to your computer and use it in GitHub Desktop.
int i = 0;
for (auto x : squares()) {
std::cout << x << std::endl;
// squares is infinite, so we need to break
if (i > 10) {
break;
}
++i;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment