Code vs. Strings: Difference between revisions

From Bohemia Interactive Community
Jump to navigation Jump to search
No edit summary
mNo edit summary
Line 1: Line 1:
'''Description:'''
'''Description:'''


Many languague constructs (including [[forEach]], [[if]], [[while]]) use the concept of "code strings".<br>
Since [[Armed Assault]] you can use ''<nowiki>'...'</nowik>'', ''"..."'' or ''""...""'' '''only''' for [[Strings]] and ''{...}'' '''only''' for [[Code]].
 
In [[Operation Flashpoint | OFP]] many languague constructs (including [[forEach]], [[if]], [[while]]) use the concept of "code strings".<br>
Code is passed as a string to them and they interpret it as code if they wish.<br>
Code is passed as a string to them and they interpret it as code if they wish.<br>
Since version 1.85, string constants can be written in two ways:
Since version 1.85, string constants can be written in two ways:


Using double quotes (like "Hello") or curled braces (like {a=a+1}).
Using double quotes (like "Hello") or curled braces (like {a=a+1}).
While both ways are currently equivalent and the string constant is created, we recommend the use of curled braces for code only, as this makes scripts easier to read - moreover future versions of scripting language may precompile code enclosed in curled braces.


[[Category: Scripting_Topics ]]
[[Category: Scripting_Topics ]]

Revision as of 19:53, 30 July 2006

Description:

Since Armed Assault you can use <nowiki>'...'</nowik>, "..." or ""..."" only for Strings and {...} only for Code.

In OFP many languague constructs (including forEach, if, while) use the concept of "code strings".
Code is passed as a string to them and they interpret it as code if they wish.
Since version 1.85, string constants can be written in two ways:

Using double quotes (like "Hello") or curled braces (like {a=a+1}).