Facebook Twitter YouTube Frictional Games | Forum | Privacy Policy | Dev Blog | Dev Wiki | Support | Gametee


Thread Rating:
  • 1 Vote(s) - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Multiple conditions in one "if" statement
convolution223 Offline
Member

Posts: 78
Threads: 15
Joined: Jul 2011
Reputation: 0
#5
RE: Multiple conditions in one "if" statement

(07-20-2011, 03:54 PM)palistov Wrote: Yes, && is the proper operator.

Also, there are lots of ways to use if statements, especially with multiple and dynamic conditions like this case.

You can do

if(GetLocalVarInt("Var01") == 1) {
    switch(GetLocalVarInt("Var02")) {
        case 1:
            //Cool stuff
        break;
        case 2:
            //Other cool stuff
        break;
    }}

There are at least 3 other neat ways to do that too, but this construct makes it easy to edit things as a result of the second variable's value.

:o what does "switch" do? and is that the proper way of writing that? with "case 1:" and "case2:" i mean. i never used cases and "switch" before
07-20-2011, 05:43 PM
Find


Messages In This Thread
RE: Multiple conditions in one "if" statement - by convolution223 - 07-20-2011, 05:43 PM



Users browsing this thread: 1 Guest(s)