Engine:CCMD var
Jump to navigation
Jump to search
Creates a new variable in the current context, if doesn't exist. If exists is ignored.
var bob fred
Arguments
- name - name for new variable
- value (optional) - the value to set. If no value, then prints value if exists
Details
Can be used to set defaults for values.
Examples
Default values
- 'var' called with 'bob' without a value. Variable 'bob' doesn't exist.
> var bob Unknown: bob
- Creates variable 'bob' and sets to 'fred'.
> var bob fred
- Same as the first example, but now bob exists.
> var bob
'bob' is 'fred'
- Try to set 'bob' to 'james', but 'bob' is already set.
> var bob james
> var bob
'bob' is 'fred'
Notes
- Will not trigger any associated events, if variable already exists when using to set a value.