generator function you can get in and leave (yield) so many times, it is perfect for declarative coding time consuming process. Modern usecase is redux-saga
// example of use generators*singleRound(){for(letdealofthis.dealing())yielddealfor(letflopofthis.theBetRound('Flop'))yieldflopfor(letflopofthis.theFlop())yieldfor(letturnofthis.theBetRound('Turn'))yieldturnyieldthis.theTurn();for(letriverofthis.theBetRound('River'))yieldriveryieldthis.theRiver();for(letshowdownofthis.theBetRound('Showdown'))yieldshowdownletwinnerIs=[]for(letscoreofthis.showScores(winnerIs))yieldscoreletwinner=this.theShowdown(winnerIs)yieldwinnerwinner.chips+=this.dealer.drawBet()for(letpauseofArray(10))yieldwinner// yield this.theShowdown()}
I enjoy coding, solving problems, playing games and watching anime. Basically, you will find me in front of a computer most of the time. Love to share experiences and learn from the experienced.
generator function you can get in and leave (yield) so many times, it is perfect for declarative coding time consuming process. Modern usecase is
redux-saga
really old poker example on codepen.io
Really cool, thank you for sharing!