लौटाओ
Translation status: हिन्दी reader-locale proof. Term names and code fences follow the hi pack; supporting prose may still be English.
Function returning a string literal via लौटाओ \"पाठ\".
Aliases: return
Syntax: लौटाओ <string-literal>
Category#
transfer
Related#
Examples#
radix/corpus/redde/redde.fab (canonical · keyword)#
Returns a value from a function.
# =============================================================================
# लौटाओ — Returns a value from a function.
# =============================================================================
#
# What this teaches:
# • Function return — `लौटाओ <expression>` returns a value from a `फलन`,
# and bare `लौटाओ` returns `रिक्त`
# • Early returns with `यदि <cond> अतः लौटाओ <expr>` for guard clauses
#
# Common mistakes:
# • Using `लौटाओ` outside a function body — `लौटाओ` is only valid inside `फलन` declarations (SEM032).
#
# See also: →, ⇥, अतः, इधरफेंको, मौन
# =============================================================================
# लौटाओ statements (function return)
#
# लौटाओ <expression> -- return a value
# लौटाओ -- return void (रिक्त)
#
# GRAMMAR:
# returnStmt :← 'लौटाओ' expr?
#
# EXPECTED OUTPUT:
# 30, Salve, Munde, 42, 0, 20
fn adde(int a, int b) → int {
return a + b
}
fn saluta(string नाम) → string {
return "Salve, " + नाम
}
fn duoetquadraginta() → int {
return 42
}
fn tace() → void {
# bare लौटाओ for रिक्त return type
return
}
fn porta(int x) → int {
if x ≺ 0 {
# early return on negative input
return 0
}
return x * 2
}
main {
print adde(10, 20)
print saluta("Munde")
print duoetquadraginta()
tace()
print porta(-5)
print porta(10)
}Expected output:
30
Salve, Munde
42
0
20
radix/corpus/scalar/return-bool.fab (canonical · keyword)#
Functions returning boolean literals via लौटाओ सत्य and लौटाओ असत्य.
# =============================================================================
# लौटाओ — Functions returning boolean literals via लौटाओ सत्य and लौटाओ असत्य.
# =============================================================================
#
# What this teaches:
# • Boolean return values — `लौटाओ सत्य` and `लौटाओ असत्य` are valid return
# expressions for `तार्किक`-typed functions
# • Demonstrates that boolean literals pass through the return statement
# unchanged
#
# Common mistakes:
# • Confusing a scalar (single-value) return with a collection return — this function returns one `तार्किक`, not a list.
#
# See also: सत्य, असत्य, तार्किक, फलन
# =============================================================================
# scalar/return-bool — return boolean literals
#
# GRAMMAR:
# returnStmt :← 'लौटाओ' expr
#
# Verifies that the Swift backend emits functions returning
# boolean literals (SC-001: primitives, functions, return).
fn da_verum() → bool {
return true
}
fn da_falsum() → bool {
return false
}radix/corpus/scalar/return-integer.fab (canonical · keyword)#
Function returning an integer literal via लौटाओ 42.
# =============================================================================
# लौटाओ — Function returning an integer literal via लौटाओ 42.
# =============================================================================
#
# What this teaches:
# • Integer return values — `लौटाओ 42` returns an integer literal from a
# `संख्या`-typed function
# • Verifies the backend emits the correct primitive type for integer returns
#
# Common mistakes:
# • Confusing a scalar (single-value) return with a collection return — this function returns one `संख्या`, not a list.
#
# See also: रिक्त, फलन
# =============================================================================
# scalar/return-integer — return integer literal
#
# GRAMMAR:
# returnStmt :← 'लौटाओ' expr
#
# Verifies that the Swift backend emits a function returning an
# integer literal (SC-001: primitives, functions, return).
fn da_numerum() → int {
return 42
}radix/corpus/scalar/return-string.fab (canonical · keyword)#
Function returning a string literal via लौटाओ \"पाठ\".
# =============================================================================
# लौटाओ — Function returning a string literal via लौटाओ "पाठ".
# =============================================================================
#
# What this teaches:
# • String return values — `लौटाओ "पाठ"` returns a string literal from a
# `पाठ`-typed function
# • Verifies the backend handles string literal return types correctly
#
# Common mistakes:
# • Confusing a scalar (single-value) return with a collection return — this function returns one `पाठ`, not a list.
#
# See also: पाठ, फलन
# =============================================================================
# scalar/return-string — return string literal
#
# GRAMMAR:
# returnStmt :← 'लौटाओ' expr
#
# Verifies that the Swift backend emits a function returning a
# string literal (SC-001: primitives, functions, return).
fn da_textum() → string {
return "textus"
}