Skip to content

Latest commit

 

History

History
15 lines (12 loc) · 336 Bytes

Powers-Of-2.md

File metadata and controls

15 lines (12 loc) · 336 Bytes

POWERS-OF-2

AIMA3e

generator Powers-Of-2() yields ints
i ← 1
while true do
  yield i
  i ← 2 x i


for p in Powers-Of-2() do
 PRINT(p)


Figure ?? Example of a generator function and its invocation within a loop.