nil: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
No edit summary
Line 58: Line 58:
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Scripting_Commands_Take_On_Helicopters|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
[[Category:Command_Group:_Variables|{{uc:{{PAGENAME}}}}]]
<!-- CONTINUE Notes -->
<dl class="command_description">
<dd class="notedate">Posted on September 25, 2014 - 09:50 (UTC)</dd>
<dt class="note">[[User:Kenoxite|Kenoxite]]</dt>
<dd class="note">
While [[isNil]] isn't available in OFP/CWA you can easily emulate it with something like this:
<pre>
_nil = format["%1",_nilstring];
?(format["%1",foo]==_nil): foo = "Hello World!"
</pre>
</dd>
</dl>
<!-- DISCONTINUE Notes -->

Revision as of 10:50, 25 September 2014

Hover & click on the images for description

Description

Description:
Nil value. This value can be used to undefine existing variables.
Groups:
Uncategorised

Syntax

Syntax:
nil
Return Value:
Void

Examples

Example 1:
variableToDestroy = nil;

Additional Information

See also:
isNilVariables

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

Notes

Mikero
Note that ArrayName = nil destroys the arrayNAME not the array content. Array content is 'destroyed' when no more ArrayNames refer to the content.
Worldeater
Never ever assign a value to nil! Doing so creates a global variable with the same name that overrides the "command" nil: foo = "foo"; nil = "bar"; foo = nil; hint foo; // displays "bar"

Bottom Section

Posted on September 25, 2014 - 09:50 (UTC)
Kenoxite
While isNil isn't available in OFP/CWA you can easily emulate it with something like this:
_nil = format["%1",_nilstring];
?(format["%1",foo]==_nil): foo = "Hello World!"