Definitionپێناسە
Catching an so that the program can react instead of crashing. In Python the risky code goes in try: and the reaction in except ValueError:; Java and C# use try and catch. Catch only the errors you expect.
گرتنی بۆ ئەوەی کاردانەوەی هەبێت لەبری ئەوەی تێک بشکێت. لە Pythonـدا کۆدە مەترسیدارەکە دەچێتە ناو try: و کاردانەوەکە دەچێتە ناو except ValueError:؛ Java و C# try و catch بەکار دەهێنن. تەنها ئەو هەڵانە بگرە کە چاوەڕێیان دەکەیت.
Exampleنموونە
This loop asks again until the user types a whole number, instead of crashing on two.
ئەم دووبارە دەپرسێتەوە تا دەنووسێت، لەبری ئەوەی بە نووسینی two تێک بشکێت.
while True:
try:
age = int(input("Age: "))
break
except ValueError:
print("Please type a whole number.")Other Kurdish renderings in useوەرگێڕانە کوردییەکانی تر
چارەسەرکردنی هەڵاوێردە
Note on the Kurdish termتێبینی دەربارەی زاراوە کوردییەکە
Built like the registry's form-handling (مامەڵەکردن لەگەڵ فۆرم) on its exception (هەڵاوێردە). Proposed.
Related termsزاراوە پەیوەندیدارەکان
Videosڤیدیۆکان
A Kurdish (Sorani) lesson on catching errors in Python with try and except, so a wrong input no longer stops the program.
وانەیەکی کوردی (سۆرانی) دەربارەی گرتنی لە بە try و except، بۆ ئەوەی هەڵە چیتر ڕانەگرێت.