User Manual
Print

Calling a Function

Call ...

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><block type=\"function_call\"><mutation name=\"doSomething\" functionid=\"null\"/></block></xml>"}
				
			

This block is used to call the function (named doSomething) that has been made. 

Parameters: Screen Item
Output: N/A
Sample code:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>number</variable><variable>mainLayout</variable><variable>mainScreen</variable><variable>dateTimeOffset</variable></variables><block type=\"function_definition\" x=\"0\" y=\"285\"><mutation name=\"calculation\" functionid=\"h1nwY;~-pRcnI]Q0^m)#\"><arg name=\"num\" id=\"gfoblss38n7o0ujrl0w2g\" type=\"number\"/><arg name=\"num2\" id=\"0bz7crm1t73tdnn9qey\" type=\"number\"/></mutation><field name=\"function_name\">calculation</field><value name=\"gfoblss38n7o0ujrl0w2g\"><shadow type=\"argument_reporter_number\"><field name=\"VALUE\">num</field></shadow></value><value name=\"0bz7crm1t73tdnn9qey\"><shadow type=\"argument_reporter_number\"><field name=\"VALUE\">num2</field></shadow></value><statement name=\"STACK\"><block type=\"variables_set\"><field name=\"VAR\">number</field><value name=\"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><next><block type=\"ScreenItem_Layout_add\"><value name=\"this\"><block type=\"variables_get\"><field name=\"VAR\">mainLayout</field></block></value><value name=\"item\"><block type=\"Control_createTextBlock\"><mutation xmlns=\"http://www.w3.org/1999/xhtml\" _expanded=\"1\" _input_init=\"true\"></mutation><value name=\"text\"><block type=\"DateTime_DateTimeOffset_toString\"><value name=\"dateTimeOffset\"><block type=\"variables_get\"><field name=\"VAR\">number</field></block></value></block></value></block></value></block></next></block></statement></block><block type=\"pxt-on-start\" x=\"0\" y=\"0\"><statement name=\"HANDLER\"><block type=\"variables_set\"><field name=\"VAR\">mainLayout</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"ScreenItem_createLayout\"/></value><next><block type=\"variables_set\"><field name=\"VAR\">mainScreen</field><value name=\"VALUE\"><shadow type=\"math_number\"><field name=\"NUM\">0</field></shadow><block type=\"Screen_create\"><value name=\"label\"><shadow type=\"text\"><field name=\"TEXT\">Main</field></shadow></value><value name=\"layout\"><block type=\"variables_get\"><field name=\"VAR\">mainLayout</field></block></value></block></value><next><block type=\"function_call\"><mutation name=\"calculation\" functionid=\"h1nwY;~-pRcnI]Q0^m)#\"><arg name=\"num\" id=\"gfoblss38n7o0ujrl0w2g\" type=\"number\"/><arg name=\"num2\" id=\"0bz7crm1t73tdnn9qey\" type=\"number\"/></mutation><value name=\"gfoblss38n7o0ujrl0w2g\"><shadow type=\"math_number\"><field name=\"NUM\">5</field></shadow></value><value name=\"0bz7crm1t73tdnn9qey\"><shadow type=\"math_number\"><field name=\"NUM\">6</field></shadow></value></block></next></block></next></block></statement></block></xml>"}
				
			

The output: