{"id":65,"date":"2026-03-01T16:00:55","date_gmt":"2026-03-01T11:00:55","guid":{"rendered":"https:\/\/gigz.pk\/python\/?post_type=lesson&#038;p=65"},"modified":"2026-03-13T10:37:00","modified_gmt":"2026-03-13T05:37:00","slug":"return-statement","status":"publish","type":"lesson","link":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/","title":{"rendered":"Return Statement"},"content":{"rendered":"\n<p>The <strong>return statement<\/strong> is used inside a function to send a result back to the place where the function was called.<\/p>\n\n\n\n<p>When Python reaches a return statement, the function stops executing and sends the value back.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHY USE RETURN?<\/strong><\/h1>\n\n\n\n<p>\u2022 To get output from a function<br>\u2022 To reuse calculated results<br>\u2022 To make functions more useful and flexible<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>BASIC SYNTAX<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">def function_name():<br>    return value<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>EXAMPLE 1: SIMPLE RETURN<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">def add(a, b):<br>    return a + bresult = add(5, 3)<br>print(result)<\/pre>\n\n\n\n<p>The function calculates the sum and returns 8.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WITHOUT RETURN VS WITH RETURN<\/strong><\/h1>\n\n\n\n<h3 class=\"wp-block-heading\">Without Return<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">def add(a, b):<br>    print(a + b)result = add(5, 3)<br>print(result)<\/pre>\n\n\n\n<p>Output:<br>8<br>None<\/p>\n\n\n\n<p>Because the function does not return anything, Python automatically returns <strong>None<\/strong>.<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">With Return<\/h3>\n\n\n\n<pre class=\"wp-block-preformatted\">def add(a, b):<br>    return a + bresult = add(5, 3)<br>print(result)<\/pre>\n\n\n\n<p>Output:<br>8<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>RETURNING MULTIPLE VALUES<\/strong><\/h1>\n\n\n\n<p>A function can return multiple values separated by commas.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def calculate(a, b):<br>    sum_value = a + b<br>    diff_value = a - b<br>    return sum_value, diff_valueresult = calculate(10, 5)<br>print(result)<\/pre>\n\n\n\n<p>Python returns them as a tuple.<\/p>\n\n\n\n<p>You can also unpack them:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">sum_result, diff_result = calculate(10, 5)<br>print(sum_result)<br>print(diff_result)<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>RETURNING BOOLEAN VALUES<\/strong><\/h1>\n\n\n\n<pre class=\"wp-block-preformatted\">def is_even(num):<br>    return num % 2 == 0print(is_even(4))<\/pre>\n\n\n\n<p>This function returns True if the number is even.<\/p>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>IMPORTANT POINTS<\/strong><\/h1>\n\n\n\n<p>\u2022 A function stops immediately after return<br>\u2022 Code written after return inside the same block will not execute<br>\u2022 If no return is written, Python returns None by default<\/p>\n\n\n\n<p>Example:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">def test():<br>    return \"Hello\"<br>    print(\"This will not run\")<\/pre>\n\n\n\n<h1 class=\"wp-block-heading\"><strong>WHY RETURN IS IMPORTANT<\/strong><\/h1>\n\n\n\n<p>\u2022 Allows functions to produce reusable output<br>\u2022 Helps in performing calculations and storing results<br>\u2022 Essential for building structured and professional programs<\/p>\n\n\n\n<p>Understanding the <strong>return statement<\/strong> is key to writing efficient and functional Python programs.<\/p>\n\n\n<div class=\"yoast-breadcrumbs\"><span><span><a href=\"https:\/\/gigz.pk\/python\/\">Home<\/a><\/span> \u00bb <span class=\"breadcrumb_last\" aria-current=\"page\">PYTHON FUNDAMENTALS (PYF) > Functions > Return Statement<\/span><\/span><\/div>\n\n\n<div class=\"schema-faq wp-block-yoast-faq-block\"><div class=\"schema-faq-section\" id=\"faq-question-1773380293242\"><strong class=\"schema-faq-question\"><\/strong> <p class=\"schema-faq-answer\"><\/p> <\/div> <\/div>\n\n\n\n<p><\/p>\n","protected":false},"menu_order":23,"template":"","class_list":["post-65","lesson","type-lesson","status-publish","hentry"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.5 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Return Statement - One Language. Endless Possibilities<\/title>\n<meta name=\"description\" content=\"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/gigz.pk\/python\/lesson\/return-statement\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Return Statement - One Language. Endless Possibilities\" \/>\n<meta property=\"og:description\" content=\"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/gigz.pk\/python\/lesson\/return-statement\/\" \/>\n<meta property=\"og:site_name\" content=\"One Language. Endless Possibilities\" \/>\n<meta property=\"article:modified_time\" content=\"2026-03-13T05:37:00+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"1 minute\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":[\"WebPage\",\"FAQPage\"],\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/return-statement\\\/\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/return-statement\\\/\",\"name\":\"Return Statement - One Language. Endless Possibilities\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\"},\"datePublished\":\"2026-03-01T11:00:55+00:00\",\"dateModified\":\"2026-03-13T05:37:00+00:00\",\"description\":\"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/return-statement\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/return-statement\\\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/lesson\\\/return-statement\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"PYTHON FUNDAMENTALS (PYF) > Functions > Return Statement\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/gigz.pk\\\/python\\\/#website\",\"url\":\"https:\\\/\\\/gigz.pk\\\/python\\\/\",\"name\":\"One Language. Endless Possibilities\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/gigz.pk\\\/python\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Return Statement - One Language. Endless Possibilities","description":"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/","og_locale":"en_US","og_type":"article","og_title":"Return Statement - One Language. Endless Possibilities","og_description":"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.","og_url":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/","og_site_name":"One Language. Endless Possibilities","article_modified_time":"2026-03-13T05:37:00+00:00","twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"1 minute"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":["WebPage","FAQPage"],"@id":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/","url":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/","name":"Return Statement - One Language. Endless Possibilities","isPartOf":{"@id":"https:\/\/gigz.pk\/python\/#website"},"datePublished":"2026-03-01T11:00:55+00:00","dateModified":"2026-03-13T05:37:00+00:00","description":"Learn Python return statement: send values from functions, return multiple results, booleans, and make reusable function outputs.","breadcrumb":{"@id":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/gigz.pk\/python\/lesson\/return-statement\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/gigz.pk\/python\/lesson\/return-statement\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/gigz.pk\/python\/"},{"@type":"ListItem","position":2,"name":"PYTHON FUNDAMENTALS (PYF) > Functions > Return Statement"}]},{"@type":"WebSite","@id":"https:\/\/gigz.pk\/python\/#website","url":"https:\/\/gigz.pk\/python\/","name":"One Language. Endless Possibilities","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/gigz.pk\/python\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson\/65","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/lesson"}],"about":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/types\/lesson"}],"wp:attachment":[{"href":"https:\/\/gigz.pk\/python\/wp-json\/wp\/v2\/media?parent=65"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}