Important Notice:

Function with Return Value

Function with Return Value

18 views 1 min read

Function with Return Value (रिटर्न वैल्यू वाला फंक्शन)

ऐसा Function जो अपना कार्य पूरा करने के बाद return Keyword की सहायता से कोई Value वापस भेजता है, उसे Function with Return Value कहते हैं।

English Definition

A function that sends a value back to the place where it was called using the return keyword is called a function with a return value.

Syntax

def function_name(parameters):
    statements
    return value

Example

def add(a, b):
    return a + b

result = add(10, 20)

print("Sum:", result)

Output:

Sum: 30 Explanation

  1. add(a, b) — दो Parameters वाला Function है।

  2. add(10, 20) — Function को Call करता है।

  3. return a + b — 30 वापस भेजता है।

  4. result = add(10, 20) — Returned Value को result में Store करता है।

  5. print() — Result Display करता है।

Related Notes