A Flash Developer Resource Site

Results 1 to 2 of 2

Thread: unusual syntax

  1. #1
    Junior Member
    Join Date
    Aug 2009
    Posts
    3

    unusual syntax

    Code:
    if (autoplay)
    {
        autoplay = autoplay == "true" ? (true) : (false);
    }
    else
    {
        autoplay = true;
    }
    I am unused to this syntax. What does it mean exactly? can anyone point me in the right direction?

    Thanks

  2. #2
    Marketting guy !
    Join Date
    Oct 2008
    Posts
    21
    This is called ternary operator.
    I can explain whats going on here..
    Here - >> autoplay = autoplay == "true" ? (true) : (false);
    The compiler excute the second part first.. that means.
    autoplay == "true" ? (true) : (false); (this part).
    Here if the autoplay is true, then i will return false otherwise return true.
    so, the second part, the return value will be stored again in "autoplay".

    Let me know if you could understand this..
    For Any Web Based Flash/Flex Project and PHP scripts, contact here
    Hitasoft Technologies
    Ripe FLV Player | Ripe HD FLV Player

Posting Permissions

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




Click Here to Expand Forum to Full Width

HTML5 Development Center