# Return in SRON

#### If you want to return a value from a function, then **'return'** attribute is used.

#### Below is a sample code:

```js
{
    name : square
    args : (Int val)
    return : ${ val^2 }
}

{
    name : Main
    Int val = square(7)
    println(val)
}
```

####

* You can return value of any type from a function.
* You cannot return multiple values from a function.
* Using ***'type'*** attribute, you can also specify the type of the value to be return from a function.

```js
{
    name : getList
    type : List
    return : ["Hello","SRON!"]
}
```

#### You can also set the return type of the function and for that you can use 'type' attribute. **'Type'** attribute converts the return value to the specified datatype only if the datatype of returned value is not same.

```js
{
    name : getValue
    type : Int
    return : 3.1415   @this value will be automatically converted to integer
}
```

### SRON uses advance return value optimization to enhance code speed and efficiency. Even if the size of the value is too big, it doesn't affect the code performance.

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://sron.gitbook.io/docs/return.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
