Fandom

武装突袭 Wiki

Throw

简体 | 繁體

4,827个页面创建
于此维基上
添加新页面
评论0 分享

您使用了广告屏蔽软件!


Wikia通过广告运营为用户提供免费的服务。我们对用户通过嵌入广告屏蔽软件访问网站进行了使用调整。

如果您使用了广告屏蔽软件,将无法使用我们的服务。请您移除广告屏蔽软件,以确保页面正常加载。

  

点击图片可看到更多讯息

开始使用于

游戏:
Armed Assault
版本:
1.00

描述

描述:
Throws an exception. The exception is processed by first catch block.



NOTE: Avoid using alternative shorthand syntax if you are planning on preparing your exception information dynamically, as it will have to be generated first regardless of the condition of the if statement before it, as shown in example 3.

基本句法

句法:
throw expression
参数:
expression: Anything
返回值:
Nothing

替代句法

句法:
if (condition) throw exception         (Since Arma 3 v1.53.133045)
参数:
if (condition): If Type - if (condition) returns true, "exception" is thrown

exception: Anything - value that will be put into _exception variable inside catch block
返回值:
Nothing

范例

范例1:
try {throw "invalid argument"} catch {hint str _exception};

范例2:
Since Arma 3 v1.53.133045: 123 try {if (_this != 123) throw "invalid argument"} catch {hint str _exception};

范例3:
The correct usage of shorthand alt syntax: try { if (a > b) throw "Error: some error"; /// OK /// The command argument is static } catch { hint str _exception; };

try { _someFunc = { ..... }; if (a > b) throw (call _someFunc); /// NOT OK /// The command argument is dynamic /// _someFunc is called first to get the value regardless of (a > b) outcome } catch { hint str _exception; };

try { _someFunc = { ..... }; if (a > b) then {throw (call _someFunc)}; /// OK /// The command argument is dynamic /// _someFunc is only called when (a > b) is true } catch { hint str _exception; };

额外资讯

多人游戏:
-
也可以看看:

Exception handlingtrycatch

注意事项

此处撰写句法皆为可行用法. 可到官网[1]专页回报错误. 你可以使用讨论页面或是论坛来进行讨论.
新增注意事项 | 如何新增?

Notes

Bottom Section

更多维基

随机维基