a / b: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
m (Text replacement - "|GAME= version" to "|game version=")
m (Text replacement - "‎" to "")
 
(37 intermediate revisions by 3 users not shown)
Line 1: Line 1:
{{Command|Comments=
{{RV|type=command
____________________________________________________________________________________________


| ofp |GAME= name
|sortKey= #


|1.00|game version=
|game1= ofp
____________________________________________________________________________________________
|version1= 1.00


| Scalar division operator. Division by 0 throws "Division by zero" error, however script doesn't stop and the result of such division is assumed to be 0. Do not confuse with [[config / name]] operator  |DESCRIPTION=
|game2= ofpe
____________________________________________________________________________________________
|version2= 1.00


| a '''/''' b |SYNTAX=
|game3= arma1
|version3= 1.00


|p1= a: [[Number]]
|game4= arma2
|version4= 1.00


|p2 = b: [[Number]]
|game5= arma2oa
|version5= 1.50


| [[Number]] |RETURNVALUE=
|game6= tkoh
____________________________________________________________________________________________
|version6= 1.00
|x1 = <code>_res <nowiki>=</nowiki> 15 '''/''' 3; //Result _res is 5</code>
|x2 = <code>_infinity <nowiki>=</nowiki> 15 '''/''' 0;
[[hint]] [[str]] [_infinity]; //Error + result is 0</code>


| [[Operators]]  |SEEALSO=
|game7= arma3
|version7= 0.50


}}
|gr1= Math
 
|gr2= Config
 
|descr= Returns the quotient of two numbers. If the divisor is 0 a ''Division by zero'' error is shown but the script does not stop and the result of such division is assumed to be 0.<br><br>
Alternative syntax returns [[Config]] entry with given name (alias for [[config greater greater name|>>]], slightly slower but with [[SQF Syntax#Rules of Precedence | higher precedence]]).
 
|s1= a [[a / b|/]] b
 
|p1= a: [[Number]] - dividend
 
|p2= b: [[Number]] - divisor
 
|r1= [[Number]] - quotient
 
|s2= config [[a / b|/]] name
 
|s2since= arma1 1.00
 
|p21= config: [[Config]]


<h3 style="display:none">Notes</h3>
|p22= name: [[String]]
<dl class="command_description">
<!-- Note Section BEGIN -->


<!-- Note Section END -->
|r21= [[Config]] - config entry
</dl>


<h3 style="display:none">Bottom Section</h3>
|x1= <sqf>_result = 15 / 3; // result is 5</sqf>


|x2= <sqf>_cfgVehicles = configFile / "CfgVehicles"; // identical to configFile >> "CfgVehicles" (but the order of precedence)</sqf>


|seealso= [[Operators]] [[configFile]] [[missionConfigFile]] [[campaignConfigFile]] [[configName]] [[config greater greater name|config >> name]] [[count]]
}}


[[Category:Scripting Commands|#]]
{{Note
[[Category:Scripting Commands OFP 1.99|#]]
|user= ffur2007slx2_5
[[Category:Scripting Commands OFP 1.96|#]]
|timestamp= 20140401000200
[[Category:Scripting Commands OFP 1.46|#]]
|text= ({{arma3}} 1.14) config / name can be composed to config >> name [[String]] or [[Array]] format via [[BIS_fnc_configPath]]. E.g.
[[Category:Scripting Commands ArmA|#]]
<sqf>
[[Category:Scripting Commands ArmA2|#]]
[configFile / "ATMineCrater" / "MissileCircleDust", ""] call BIS_fnc_configPath; // return: "configfile >> "ATMineCrater" >> "MissileCircleDust""
[[Category:Scripting Commands Arma 3|#]]
[configFile / "ATMineCrater" / "MissileCircleDust", []] call BIS_fnc_configPath; // return: ["configfile","ATMineCrater","MissileCircleDust"]
[[Category:Command_Group:_Math|#]]
</sqf>
[[Category:Command_Group:_Variables|#]]
}}

Latest revision as of 12:55, 26 April 2023

Hover & click on the images for description

Description

Description:
Returns the quotient of two numbers. If the divisor is 0 a Division by zero error is shown but the script does not stop and the result of such division is assumed to be 0.

Alternative syntax returns Config entry with given name (alias for >>, slightly slower but with higher precedence).
Groups:
MathConfig

Syntax

Syntax:
a / b
Parameters:
a: Number - dividend
b: Number - divisor
Return Value:
Number - quotient

Alternative Syntax

Syntax:
config / name
Parameters:
config: Config
name: String
Return Value:
Nothing

Examples

Example 1:
_result = 15 / 3; // result is 5
Example 2:
_cfgVehicles = configFile / "CfgVehicles"; // identical to configFile >> "CfgVehicles" (but the order of precedence)

Additional Information

See also:
Operators configFile missionConfigFile campaignConfigFile configName config >> name count

Notes

Report bugs on the Feedback Tracker and/or discuss them on the Arma Discord or on the Forums.
Only post proven facts here! Add Note
ffur2007slx2_5 - c
Posted on Apr 01, 2014 - 00:02 (UTC)
(Arma 3 1.14) config / name can be composed to config >> name String or Array format via BIS_fnc_configPath. E.g.
[configFile / "ATMineCrater" / "MissileCircleDust", ""] call BIS_fnc_configPath; // return: "configfile >> "ATMineCrater" >> "MissileCircleDust"" [configFile / "ATMineCrater" / "MissileCircleDust", []] call BIS_fnc_configPath; // return: ["configfile","ATMineCrater","MissileCircleDust"]