Control Structures – Talk

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
m (added comment)
Line 2: Line 2:


Also I can't get "switch" to work , anyone know how to use it? These examples are not working... --[[User:Messiah2|Messiah(UA)]] 12:19, 25 December 2006 (CET)
Also I can't get "switch" to work , anyone know how to use it? These examples are not working... --[[User:Messiah2|Messiah(UA)]] 12:19, 25 December 2006 (CET)
:1. yes that's true if used in [[SQF syntax]] scripts or functions. The structures are like any [[Statement]]: If used in [[SQF syntax]] scripts or functions, you have to add the semicolon ";" (except if you want to use the structure as return value of the function). Should we add the semicolons in the examples?
:2. I just noticed that there doesn't seem to be a ":" after "default". Also, it could be that you ''must'' include a default block, even if empty. Could you test that, maybe?
Apart from that, what are your errors? Take care that you have to write control structures into a single line if used in [[SQS syntax]] scripts.

Revision as of 16:00, 25 December 2006

Tried "if" and "switch" structures. "If" examples are wrong here! They don't work, because each block '{ }' must end with ';'. Am I right?

Also I can't get "switch" to work , anyone know how to use it? These examples are not working... --Messiah(UA) 12:19, 25 December 2006 (CET)

1. yes that's true if used in SQF syntax scripts or functions. The structures are like any Statement: If used in SQF syntax scripts or functions, you have to add the semicolon ";" (except if you want to use the structure as return value of the function). Should we add the semicolons in the examples?
2. I just noticed that there doesn't seem to be a ":" after "default". Also, it could be that you must include a default block, even if empty. Could you test that, maybe?

Apart from that, what are your errors? Take care that you have to write control structures into a single line if used in SQS syntax scripts.