Maxon Developers Maxon Developers
    • Documentation
      • Cinema 4D Python API
      • Cinema 4D C++ API
      • Cineware API
      • ZBrush Python API
      • ZBrush GoZ API
      • Code Examples on Github
    • Forum
    • Downloads
    • Support
      • Support Procedures
      • Registered Developer Program
      • Plugin IDs
      • Contact Us
    • Categories
      • Overview
      • News & Information
      • Cinema 4D SDK Support
      • Cineware SDK Support
      • ZBrush 4D SDK Support
      • Bugs
      • General Talk
    • Unread
    • Recent
    • Tags
    • Users
    • Login

    If Statement

    General Discussion
    0
    2
    380
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • H
      Helper
      last edited by

      THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

      On 08/06/2010 at 16:06, xxxxxxxx wrote:

      Is there any benefit over doing an if statement like this?

      x == 10 ? y = 16 : y = 5;
      

      as opposed to

      if (x = 10)
      {
      	y = 16;
      }
        
      else
      {
      	y=5;
      }
      

      Thanks,

      Shawn

      1 Reply Last reply Reply Quote 0
      • H
        Helper
        last edited by

        THE POST BELOW IS MORE THAN 5 YEARS OLD. RELATED SUPPORT INFORMATION MIGHT BE OUTDATED OR DEPRECATED

        On 09/06/2010 at 02:27, xxxxxxxx wrote:

        The only real benefit is that it's shorter. You can also use the ? operator in function calls.

        Example:

        MyFunction(x == 10 ? 16 : 5);
        

        as opposed to

          
        if (x == 10)  
          MyFunction(16);  
        else  
          MyFunction(5);  
        

        cheers,
        Matthias

        1 Reply Last reply Reply Quote 0
        • First post
          Last post