Ask a Question related to Macromedia Flash Actionscript, Design and Development.

  1. #1

    Default Re: condition

    hey jan... i do it like this:

    function existRec (name) {
    for (i=0; i<recs.length; i++) {
    if (recs[i] == name) {
    return true;
    }
    }
    return false;
    }
    FranzTheOne Guest

  2. Similar Questions and Discussions

    1. ?: condition
      eh, probably dumm question but why is asking to return a value not working here? for (var i=0;i< x.length; i++) { x ? : return true : null; }
    2. ASP, using SQL COUNT as a condition in IF ELSE statement
      I am trying to do a simple "less than" conditional statement, and hitting a brick wall if I use a database element with it. This DOES work: <%...
    3. complex condition
      I know there must be a way to do the following: if (($foobar > 3) || ($foo="t" && $bar = "b")) {print "yup"} Of course this is wrong, but what...
    4. DB2 upgrade condition
      Hi all, i've got db2 udb enterprise server v. 7.1 .... it's possible to upgrade to 7.2 or 8.1 ? It's free? Thanks Stefano
    5. Trying to create a condition statement in
      Ampersand. && My mistake was that I did not put the word 'javascript:' in front of the script. mybutton.attributes.add ( "javascript:if...
  3. #2

    Default Re: condition

    Yep, that works and is what i am using now.
    I am just curious why i can not use the return with condition ? expression : expression...
    any thoughts??

    JanFlash Guest

  4. #3

    Default Re: condition

    you can .. you just coded it wrong.

    return condition ? value1 : value2;

    you cannot put statement in the ?: .. only expressions .. so you cannot have
    condition ? return value1 : return value2;

    for statements, use if

    if (condition) {
    return value1;
    } else {
    return value2;
    }
    > I am just curious why i can not use the return with condition ? expression
    : expression...
    > any thoughts??

    Jeckyl Guest

  5. #4

    Default Re: condition

    eh, true, but... it now returns (true or false) no matter what... so it breaks
    the loop (at i==0) none of the other index is checked..
    so i guess what you are saying is return (statement) cannot be put in only
    expressions..

    JanFlash Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139