Lucky44 13 Posted December 30, 2010 I can't believe I can't find the answer to this...maybe it's not possible. I just want to have a multi-condition like this: if (_size >= 11) and (_size <= 50) then... And I can't seem to find the answer anywhere. How do you put two conditions in an If statement? Could I do: if (11<_size>=50) then... or something like that??? Share this post Link to post Share on other sites
[frl]myke 14 Posted December 30, 2010 if ((_size >= 11) and (_size >= 50)) then { Share this post Link to post Share on other sites
Lucky44 13 Posted December 30, 2010 Myke;1824099']if ((_size >= 11) and (_size >= 50)) then { Thanks! It was making me crazy! I thought there should be a way to do that. Share this post Link to post Share on other sites
GDICommand 10 Posted December 31, 2010 (edited) I can't believe I can't find the answer to this...maybe it's not possible.I just want to have a multi-condition like this: if (_size >= 11) and (_size <= 50) then... And I can't seem to find the answer anywhere. How do you put two conditions in an If statement? Could I do: if (11<_size>=50) then... or something like that??? not to say the way the above poster says to do it is wrong, but the proper way to 'and' something, and receive a boolean in return, is using: if (_size >= 11 && _size <= 50) then { ... } inversely, the or operation is: if (_size >= 11 || _size <= 50) then { ... } EDIT: actually, here is a link that might help you. specifically for boolean operations, look under the section that starts with '#' Arma2 scripting commands Edited December 31, 2010 by GDICommand Share this post Link to post Share on other sites
i0n0s 0 Posted December 31, 2010 not to say the way the above poster says to do it is wrong, but the proper way to 'and' something, and receive a boolean in return, is using: ... Proper way... http://community.bistudio.com/wiki/and Both ways work and you need to decide for yourself which way do you like. Share this post Link to post Share on other sites
GDICommand 10 Posted December 31, 2010 Proper way...http://community.bistudio.com/wiki/and Both ways work and you need to decide for yourself which way do you like. the reason why i said it's the proper way, is because if you go past mission creating and go to learn an actual language, 'and' is not a keyword for any language ive encountered. '&&' is what is used (c, c++, Java, c#, etc). so id rather teach how to use booleans, rather than use what arma considers a keyword Share this post Link to post Share on other sites
AZCoder 921 Posted December 31, 2010 (edited) I think it might stem from SQS which is sort of a VB derivative (spiritually speaking), and VB uses AND. I personally prefer && since I come from a C background, but either works the same for SQF. Edited December 31, 2010 by AZCoder Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 31, 2010 If you guys wanted to debate "proper", you'd simply advise which way was interpreted and executed fastest in ArmA2 ! :rolleyes: Share this post Link to post Share on other sites
gossamersolid 155 Posted December 31, 2010 Gnat;1824362']If you guys wanted to debate "proper"' date=' you'd simply advise [b']which way was interpreted and executed fastest[/b] in ArmA2 ! :rolleyes: which is && correct? I just use && and || for statements as I learned that in other languages and it's relevant there as well. Share this post Link to post Share on other sites
i0n0s 0 Posted December 31, 2010 They should be equivalent in speed, at least if implemented correctly ... Share this post Link to post Share on other sites
gossamersolid 155 Posted December 31, 2010 They should be equivalent in speed, at least if implemented correctly ... IIRC the engine is coded in C++ right? && and || are directly used in C++ so maybe the engine wouldn't have to interpret it and it could directly use it. I'm just talking out of my ass. I'm not sure how the engine works at all lol. Share this post Link to post Share on other sites
[aps]gnat 28 Posted December 31, 2010 I dont know. BIS wrote the base code, so justifying speed using another system example (like C++) may not be valid. Challenge for a uber environmental scripter; Write a test script to prove one way or the other. Share this post Link to post Share on other sites