|
/*
Samples code snippets for article
"Working around Language Limitations: Making Enumerations Enumerate
Generic classes for enumeration-based iteration and array indexing"
Copyright (C) 2008-2010 by Sergey A Kryukov
http://www.SAKryukov.org
*/
namespace JustTests {
internal class SimplestIteration {
enum CardSuit { Clubs, Diamonds, Spades, Hearts, }
internal void IterationSample() {
for (CardSuit loopVariable = CardSuit.Clubs; loopVariable <= CardSuit.Hearts; loopVariable++) {
//use loopVarible
} //loop CardSuit
for (CardSuit loopVarible = CardSuit.Hearts; loopVarible <= CardSuit.Clubs; loopVarible--) {
//use loopVarible
} //loop CardSuit
} //IterationSample
} //class SimplestIteration
} //namespace JustTests
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Physics, physical and quantum optics, mathematics, computer science, control systems for manufacturing, diagnostics, testing, and research, theory of music, musical instruments… Contact me:
https://www.SAKryukov.org