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
xiphirx Offline
Senior Member

Posts: 662
Threads: 16
Joined: Nov 2010
Reputation: 5
#11
RE: Multiple conditions in one "if" statement

(07-20-2011, 06:23 PM)Kyle Wrote:
(07-20-2011, 06:14 PM)xiphirx Wrote: Sorry, this is not advanced scripting, you're still at the beginner level.

It would help if you knew C/++ beforehand, but it looks like you're learning as you go.

The first two examples that Kyle posted in his first post are incorrect as they do not have the same effect. Also, you do not need the return statement really, its a void function to begin with.

Excuse you, I know C++ already and I know they don't have the same effect. Of course I know that the second one has the effect of, in this case, that if the first "if" statement is incorrect, then the second one works nevertheless. I just didn't point out that in the second case that it could be applied to a statement that includes more than 2 values. Also, please try to be nice, I know that it's not advanced, I just want him to feel good and confident to actually reach that level and not sink back and become careless by no motivation. :/

About that "return" statement, it could be needed if the "if" statement is added on with the factor of having something in the case if none of the "if" statements are true.

"Excuse you", I was talking to the OP in regards to knowing C++. The first two examples wont accomplish what hes trying to do, have two statements bounded by and be true before executing actions. You should have only shown the third code snippet.

I fail to see where I'm being harsh. I'm just being realistic. I would rather not bullshit the OP into thinking hes doing really high level stuff and get his hopes down when he actually does do advanced stuff. Motivation is his issue, not yours. Even if he had alot of C++ knowledge, it wouldn't matter since motivation is a independent feeling.

The return statement has no point in the function other than cutting it off early, which will happen when you reach the end anyway.

07-20-2011, 06:43 PM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#12
RE: Multiple conditions in one "if" statement

I was only referring to more advanced scripting for ME, never did I say that it is the hardest thing to do. I know that it is still very much beginner programming. I only came here to ask a question and I got that answered, motivation isn't an issue. Thanks regardless.
07-20-2011, 07:13 PM
Find
nemesis567 Offline
Posting Freak

Posts: 874
Threads: 65
Joined: May 2011
Reputation: 10
#13
RE: Multiple conditions in one "if" statement

(07-20-2011, 06:14 PM)xiphirx Wrote: Sorry, this is not advanced scripting, you're still at the beginner level.

It would help if you knew C/++ beforehand, but it looks like you're learning as you go.

The first two examples that Kyle posted in his first post are incorrect as they do not have the same effect. Also, you do not need the return statement really, its a void function to begin with.

Return isn't returning nothing as it can't because we're working on a void function but it stops the code from executing in the same or lower hierarchy levels. For instance he could have the continuation of his function bellow.

This is the basics of coding, there is nothing close to intermediate here, there is nothing close to advanced and few things under intermediate levels in amnesia level scripting.

Today I dreamt the life I could live forever. You only know that when you feel it for you know not what you like until you've experienced it.
(This post was last modified: 07-20-2011, 10:43 PM by nemesis567.)
07-20-2011, 10:43 PM
Find
xiphirx Offline
Senior Member

Posts: 662
Threads: 16
Joined: Nov 2010
Reputation: 5
#14
RE: Multiple conditions in one "if" statement

(07-20-2011, 07:13 PM)Roenlond Wrote: I was only referring to more advanced scripting for ME, never did I say that it is the hardest thing to do. I know that it is still very much beginner programming. I only came here to ask a question and I got that answered, motivation isn't an issue. Thanks regardless.

I never stated that what you were trying to do was "the hardest thing to do".

I know all you came for was a question, and I'm glad you got it answered, I just didn't want you to follow false information.
(07-20-2011, 10:43 PM)nemesis567 Wrote:
(07-20-2011, 06:14 PM)xiphirx Wrote: Sorry, this is not advanced scripting, you're still at the beginner level.

It would help if you knew C/++ beforehand, but it looks like you're learning as you go.

The first two examples that Kyle posted in his first post are incorrect as they do not have the same effect. Also, you do not need the return statement really, its a void function to begin with.

Return isn't returning nothing as it can't because we're working on a void function but it stops the code from executing in the same or lower hierarchy levels. For instance he could have the continuation of his function bellow.

This is the basics of coding, there is nothing close to intermediate here, there is nothing close to advanced and few things under intermediate levels in amnesia level scripting.

"return" in that sense is, indeed, returning nothing. It has no use in a void function and is pretty redundant. I know it stops the code from executing, but I would rather not chug returns everywhere, it just looks messy and it can mess with your program flow.

To illustrate my point:
void function(somevar var)
{
    if (var)
    {
        // do stuff
    }
    else
        return;
}

Should be

void function(somevar var)
{
    if (var)
    {
        // do stuff
    }
}

Both do the exact same thing, but the latter is less code, and isn't redundant.

(This post was last modified: 07-21-2011, 12:31 AM by xiphirx.)
07-21-2011, 12:27 AM
Find
Ideka Offline
Junior Member

Posts: 16
Threads: 3
Joined: Jul 2011
Reputation: 1
#15
RE: Multiple conditions in one "if" statement

Define "advanced".
07-21-2011, 04:24 AM
Find
Roenlond Offline
Senior Member

Posts: 331
Threads: 3
Joined: Apr 2011
Reputation: 0
#16
RE: Multiple conditions in one "if" statement

Jesus, why are you people getting stuck on "advanced"? I didn't mean advanced per se. I guess it was a poor choice of words. Let's put it this way - something different - all right?
07-21-2011, 11:35 AM
Find
DRedshot Offline
Senior Member

Posts: 374
Threads: 23
Joined: Jun 2011
Reputation: 11
#17
RE: Multiple conditions in one "if" statement

Quote:Define "advanced".
Advanced

(This post was last modified: 07-21-2011, 11:43 AM by DRedshot.)
07-21-2011, 11:39 AM
Find
Ideka Offline
Junior Member

Posts: 16
Threads: 3
Joined: Jul 2011
Reputation: 1
#18
RE: Multiple conditions in one "if" statement

(07-21-2011, 11:35 AM)Roenlond Wrote: Jesus, why are you people getting stuck on "advanced"? I didn't mean advanced per se. I guess it was a poor choice of words. Let's put it this way - something different - all right?
My point is that nothing is "advanced", because that's relative. Your question was not advanced, but it certainly was about something more advanced than what you are (or were Wink) used to.

(07-21-2011, 11:39 AM)DRedshot Wrote:
Quote:Define "advanced".
Advanced
Fair enough.
07-21-2011, 05:30 PM
Find




Users browsing this thread: 4 Guest(s)