Të përgjithshme

Return value

Në shqip: Vlera kthyese

ShpjegimiSQ

Vlera kthyese është rezultati që funksioni ta kthen mbrapsht kur mbaron punën, me fjalën „return“. Këtë rezultat mund ta ruash në një variabël ose ta përdorësh më tej.

EnglishEN

A return value is the result a function hands back when it finishes, using the word “return”. You can store that result in a variable or use it further.

Si ta mendosh

Si në dyqan: i jep shitësit 10 euro për diçka që kushton 7, e ai ta kthen kusurin — 3 euro. Kusuri është vlera kthyese.

Lexoje në anglisht

Like at a shop: you give the cashier 10 euros for something that costs 7, and they hand back your change — 3 euros. The change is the return value.

Shembull kodipython

def kusuri(pagova, cmimi):
    return pagova - cmimi

mbetja = kusuri(10, 7)
print(mbetja)  # 3

Terma të lidhur