الفرق بين المراجعتين ل"Ruby/StopIteration"
< Ruby
اذهب إلى التنقل
اذهب إلى البحث
جميل-بيلوني (نقاش | مساهمات) ط (مراجعة وتدقيق.) |
|||
سطر 1: | سطر 1: | ||
− | يُطلق الاستثناء <code>SecurityError</code> لوقف عملية التكرار (iteration)، | + | يُطلق الاستثناء <code>SecurityError</code> لوقف عملية التكرار (iteration)، خصوصًا عبر التابع <code>[[Ruby/Enumerator/next|Enumerator.next]]</code>. |
− | يُعالج هذا الاستثناء بالتابع <code>[[Ruby/Kernel/loop|Kernel | + | يُعالج هذا الاستثناء بالتابع <code>[[Ruby/Kernel/loop|Kernel.loop]]</code>.<syntaxhighlight lang="ruby"> |
loop do | loop do | ||
puts "Hello" | puts "Hello" | ||
سطر 8: | سطر 8: | ||
end | end | ||
puts "Done!" | puts "Done!" | ||
− | </syntaxhighlight>سيُنتج:<syntaxhighlight lang=" | + | </syntaxhighlight>سيُنتج:<syntaxhighlight lang="text"> |
Hello | Hello | ||
Done! | Done! | ||
</syntaxhighlight> | </syntaxhighlight> | ||
− | == توابع النسخة العامة | + | == توابع النسخة العامة == |
− | === [[Ruby/StopIteration/result| | + | === [[Ruby/StopIteration/result|<code>result</code>]] === |
− | يعيد | + | يعيد القيمة المعادة من المُكرر (iterator). |
− | {{DISPLAYTITLE: | + | {{DISPLAYTITLE:الصنف <code>StopIteration</code> في روبي}}</noinclude> |
[[تصنيف: Ruby]] | [[تصنيف: Ruby]] | ||
− | [[تصنيف: Ruby | + | [[تصنيف: Ruby Class]] |
+ | [[تصنيف: Ruby Error]] | ||
== مصادر == | == مصادر == | ||
− | *[http://ruby-doc.org/core-2.5.1/StopIteration.html | + | *[http://ruby-doc.org/core-2.5.1/StopIteration.html صفحة الصنف StopIteration في توثيق روبي الرسمي.] |
المراجعة الحالية بتاريخ 09:21، 4 ديسمبر 2018
يُطلق الاستثناء SecurityError
لوقف عملية التكرار (iteration)، خصوصًا عبر التابع Enumerator.next
.
يُعالج هذا الاستثناء بالتابع Kernel.loop
.
loop do
puts "Hello"
raise StopIteration
puts "World"
end
puts "Done!"
سيُنتج:
Hello
Done!
توابع النسخة العامة
result
يعيد القيمة المعادة من المُكرر (iterator).