Documentation

Una is developed by Una Technologies Limited

All rights reserved

© 2022 Una Technologies Limited

Print

Returning a Value

Return

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"function_return\" disabled=\"true\" x=\"-23\" y=\"68\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" no_return_value=\"false\"></mutation><value name=\"RETURN_VALUE\"><shadow type=\"math_number\" disabled=\"true\"><field name=\"NUM\">0</field></shadow></value></block></xml>"}
				
			

This block is used to return a value inside the function.

Parameters: Screen Item

Output: N/A

Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"function_definition\" x=\"515\" y=\"20\"><mutation name=\"calculation\" functionid=\"eH{`]sqvSb3?quN?d!EZ\"><arg name=\"num\" id=\"7kqhi4xmekpy42m05w8l\" type=\"number\"/><arg name=\"num2\" id=\"ufjwr2oj3x3rjb9dg1zx\" type=\"number\"/></mutation><field name=\"function_name\">calculation</field><value name=\"7kqhi4xmekpy42m05w8l\"><shadow type=\"argument_reporter_number\"><field name=\"VALUE\">num</field></shadow></value><value name=\"ufjwr2oj3x3rjb9dg1zx\"><shadow type=\"argument_reporter_number\"><field name=\"VALUE\">num2</field></shadow></value><statement name=\"STACK\"><block type=\"function_return\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" no_return_value=\"false\"></mutation><value name=\"RETURN_VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"math_arithmetic\"><field name=\"OP\">MULTIPLY</field><value name=\"A\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"argument_reporter_number\"><field name=\"VALUE\">num</field></block></value><value name=\"B\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"argument_reporter_number\"><field name=\"VALUE\">num2</field></block></value></block></value></block></statement></block><block type=\"pxt-on-start\" x=\"20\" y=\"20\"><statement name=\"HANDLER\"><block type=\"basic_consoleLogNum\"><value name=\"num\"><block type=\"function_call_output\"><mutation name=\"calculation\" functionid=\"eH{`]sqvSb3?quN?d!EZ\"><arg name=\"num\" id=\"7kqhi4xmekpy42m05w8l\" type=\"number\"/><arg name=\"num2\" id=\"ufjwr2oj3x3rjb9dg1zx\" type=\"number\"/></mutation><value name=\"7kqhi4xmekpy42m05w8l\"><shadow type=\"math_number\"><field name=\"NUM\">2</field></shadow></value><value name=\"ufjwr2oj3x3rjb9dg1zx\"><shadow type=\"math_number\"><field name=\"NUM\">3</field></shadow></value></block></value></block></statement></block></xml>"}
				
			

The output:

Call - Output
Next Calling a Function