Definitionپێناسە
A rule in Java, C# and many other languages: a variable made inside a (between { }) exists only in that block. Python has no block scope: a variable made inside an if or a loop can still be used after it, until the function ends.
یاسایەکە لە Java، C# و زۆر زمانی تردا: کە لەناو (لە نێوان { }) دروست دەکرێت تەنها لەو بلۆکەدا هەیە. Python مەودای بلۆکی نییە: کە لەناو if یان دروست دەکرێت دوای ئەویش بەکار دێت، تا کۆتایی دێت.
Exampleنموونە
In Python, square made inside the loop is still there after it; in Java the same code would not compile.
لە Pythonـدا square کە لەناو دروست کراوە دوای ئەویش ماوە؛ لە Javaـدا هەمان کۆد کۆمپایل نابێت.
for i in range(3):
square = i * i
print(square) # 4Note on the Kurdish termتێبینی دەربارەی زاراوە کوردییەکە
Built on the registry's scope (مەودا) and code-block (بلۆکی کۆد). Proposed.
Related termsزاراوە پەیوەندیدارەکان
Videosڤیدیۆکان
A variable made inside an if block with const exists only in that block; using it after the block gives 'c is not defined'.
لە ، کە بە const لەناو ifـدا دروست بکرێت تەنها لەوێدا هەیە؛ بەکارهێنانی لە دوای c is not defined دەدات.