Pass­ing val­ues to gen­er­a­tors and yield

OpenSource For You - - DEVELOPERS -

The fol­low­ing ex­am­ple shows the pass­ing of a value to a gen­er­a­tor func­tion, just like any other func­tion. It also il­lus­trates the pass­ing of the value from the next() method. This al­lows the pass­ing of val­ues between gen­er­a­tor and con­trol­ling code.

Newspapers in English

Newspapers from India

© PressReader. All rights reserved.