文檔

聯絡我們

地址:香港科學園科技大道西19號3樓345室

電郵:[email protected]

電話/WhatsApp:+852 67112315

Print

返回一個值

返回

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><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></value></block></xml>"}
				
			

這積木是用作從函式返回一個數值。

參數:螢幕項目

輸出:N/A

示例代碼:

				
					{"blocks":"<xml xmlns=\"https://developers.google.com/blockly/xml\"><variables><variable>mainLayout</variable><variable>mainScreen</variable><variable>dateTimeOffset</variable></variables><block type=\"function_definition\" x=\"20\" y=\"305\"><mutation name=\"calculation\" functionid=\"O$xs+CBy0Ty=@dN;0n7q\"><arg name=\"num\" id=\"b1x9b17oeik0sacu18ayb\" type=\"number\"/><arg name=\"num2\" id=\"pa6vzne4zkvawshxz5w6j\" type=\"number\"/></mutation><field name=\"function_name\">calculation</field><value name=\"b1x9b17oeik0sacu18ayb\"><shadow type=\"argument_reporter_number\"><field name=\"VALUE\">num</field></shadow></value><value name=\"pa6vzne4zkvawshxz5w6j\"><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=\"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=\"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=\"function_call_output\"><mutation name=\"calculation\" functionid=\"O$xs+CBy0Ty=@dN;0n7q\"><arg name=\"num\" id=\"b1x9b17oeik0sacu18ayb\" type=\"number\"/><arg name=\"num2\" id=\"pa6vzne4zkvawshxz5w6j\" type=\"number\"/></mutation><value name=\"b1x9b17oeik0sacu18ayb\"><shadow type=\"math_number\"><field name=\"NUM\">1</field></shadow></value><value name=\"pa6vzne4zkvawshxz5w6j\"><shadow type=\"math_number\"><field name=\"NUM\">1</field></shadow></value></block></value></block></value></block></value></block></next></block></next></block></statement></block></xml>"}
				
			

輸出結果:

Next 呼叫一個函式