www.webdeveloper.com
Page 1 of 2 12 LastLast
Results 1 to 15 of 24

Thread: IF... IF... IF... ELSE... not working

  1. #1
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    15

    Unhappy IF... IF... IF... ELSE... not working

    Can somebody tell me why this code is screwing up?...
    (I will use underscores to format it)

    function whatever() {
    ___if SP = 1 {
    ______if (t=='*') {
    _________do this;
    _________do that;
    _________etc...
    ______}
    ______if (t=='^') {
    _________do this;
    _________do that;
    _________etc...
    ______}
    ___}
    ___else {
    ______do this;
    ______do that;
    ______etc...
    ___}
    }


    Regards;
    The Kooky Dutchman
    Last edited by rbleskow999; 07-25-2005 at 09:25 AM.

  2. #2
    Join Date
    Jul 2004
    Posts
    986
    Prolly because all of those stupid underscores...
    That and you're missing an else/if amongst your psuedo conditionals...

    BTW: Get rid of the underscores and use [code] -CODE HERE- [/code] tags when posting code...
    Last edited by Willy Duitt; 07-24-2005 at 10:31 PM.

  3. #3
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    15
    you should READ what I wrote...

    I said:

    (I will use underscores to format it)

    Regards;
    The Kooky Dutchman
    Last edited by rbleskow999; 07-25-2005 at 09:25 AM.

  4. #4
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    15

    Thumbs up

    P R O B L E M . . . S O L V E D ! ! !

    I needed brackets around the: SP = 1

    simple oversight.

    Regards;
    The Kooky Dutchman
    Last edited by rbleskow999; 07-25-2005 at 09:26 AM.

  5. #5
    Join Date
    Jul 2004
    Posts
    986
    Quote Originally Posted by rbleskow999
    P R O B L E M . . . S O L V E D ! ! !

    I needed brackets around the: SP = 1

    simple oversight.
    Those would be: parenthesis....
    I noticed that but what am I to know from poorly formatted psuedo code...

    Glad to hear you got it fixed...
    But please remember, we work best with absolutes...

    .....Willy

  6. #6
    Join Date
    Dec 2002
    Location
    Taiwan
    Posts
    1,297
    Quote Originally Posted by rbleskow999
    I needed brackets around the: SP = 1
    Quote Originally Posted by Willy Duitt
    Those would be: parenthesis....
    Jeez, give him a break. He's probably British or something, or just unfamiliar with programming terminology.
    The Web Standards Project Build accessible standard compliant websites, please!
    Browse Happy Don't forget to support the browsers with standard compliance

  7. #7
    Join Date
    Jul 2004
    Posts
    986
    Quote Originally Posted by Exuro
    Jeez, give him a break. He's probably British or something, or just unfamiliar with programming terminology.
    SHUT UP STUPID...

    Whatever remarks I made had to do with his adding underscores for foramtting...

    Step off your "I'm L33T" and kiss my a$$...

    .....Willy

  8. #8
    Join Date
    Jul 2004
    Posts
    986
    Quote Originally Posted by Willy Duitt
    SHUT UP STUPID...

    Whatever remarks I made had to do with his adding underscores for foramtting...

    Step off your "I'm L33T" and kiss my a$$...

    .....Willy
    Oh... I forgot...

  9. #9
    Join Date
    Nov 2002
    Location
    England
    Posts
    693
    Jeez, give him a break. He's probably British or something, or just unfamiliar with programming terminology.
    Excuse me? Are British people thick? Do British people not know programming terminology? God you people make me sick.

    You probably need to change the line: if SP = 1 {

    to if(SP == 1) {

    the if statement if(SP=1) does not actually test SP against the value on the right hand side ("1"). The if statement can be translated as:

    if 1 can be assigned to SP then...

    The line if(SP == 1) can be translated as:

    if SP is equal to 1 then ...

    Regards
    Last edited by Scriptage; 07-25-2005 at 06:59 AM.

  10. #10
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    15
    Thanks Scriptage for your "positive" input.
    Bye the way, the calculations work when I use "=", and they don't work when I use "==". go figure...

    I'm sure that willy guy has a chip on his shoulder (that he knows about, but he ignores it). It's a superiority complex. We'll just have to live with it.
    Even Albert Einstein didn't know what Babe Ruth's batting average was....
    Let's all try to relax, shall we?

    By the way willy: (brackets == parenthesis) on THIS planet, too.

    Regards;
    The Kooky Dutchman
    Last edited by rbleskow999; 07-25-2005 at 09:32 AM.

  11. #11
    Join Date
    May 2004
    Location
    Manhattan NY
    Posts
    6,028
    Actually you don't have to live with it. He's banned.

  12. #12
    Join Date
    Jul 2005
    Location
    Holland
    Posts
    15
    WOW!... That was quick!
    Last edited by rbleskow999; 07-25-2005 at 10:08 AM.
    Regards;
    The Kooky Dutchman

  13. #13
    Join Date
    Nov 2002
    Location
    Hermantown, MN
    Posts
    1,777
    We aim to please!
    Compguy Pete
    The Benevolent Administrator

    No child should have to deal with a Brain Stem Tumor...
    http://www.OneAna.com

  14. #14
    Join Date
    Dec 2002
    Location
    Taiwan
    Posts
    1,297
    Quote Originally Posted by Scriptage
    Excuse me? Are British people thick? Do British people not know programming terminology? God you people make me sick.

    I didn't mean any of those things at all. All I was saying is that I'm pretty sure they call parentheses "brackets" in Britain (am I wrong?), and that if he's new to programming he might not know that that's what you're supposed to call them.
    The Web Standards Project Build accessible standard compliant websites, please!
    Browse Happy Don't forget to support the browsers with standard compliance

  15. #15
    Join Date
    Jul 2005
    Location
    USA
    Posts
    3,910
    Quote Originally Posted by rbleskow999
    By the way willy: (brackets == parenthesis) on THIS planet, too.
    Not technically correct. This is like the square/rectangle thing -- a square is always a rectangle, but a rectangle is not necessarily a square.

    One kind of bracket is the parenthesis, but since there are multiple kinds of brackets, they are not necessarily the same.

    Types of brackets:
    • () parenthesis
    • [] square brackets
    • <> angle brackets
    • {} (curly) braces


    I would appreciate it if you would refer to "(" and ")" as parenthesis to avoid confusion.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles