Skip to content

Commit 6a2205d

Browse files
authored
Prime::PseudoPrimeGenerator#each_with_index のサンプルコードが動かないのを解決
#2114 を解決します。
1 parent d2fa080 commit 6a2205d

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

manual/api/prime/Prime__PseudoPrimeGenerator.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,14 @@ include:
6868

6969
```ruby title="例"
7070
require 'prime'
71-
Prime::EratosthenesGenerator.new(10).each_with_index do |prime, index|
71+
Prime::EratosthenesGenerator.new.each_with_index do |prime, index|
72+
break if prime > 10
7273
p [prime, index]
7374
end
74-
# [2, 0]
75-
# [3, 1]
76-
# [5, 2]
77-
# [7, 3]
75+
# => [2, 0]
76+
# [3, 1]
77+
# [5, 2]
78+
# [7, 3]
7879
```
7980

8081
- **SEE** [m:Enumerator#with_index]

0 commit comments

Comments
 (0)