5 Replies Latest reply on Jun 11, 2012 4:43 AM by Ned Murphy

    nested if "logic" question

    ImperialUser Level 1

      I've got 6 locations in an object that will be clickable (color pallet red-purple).  I am determining which color was clicked on by the mouse location at on(press), in comparision to the objects location.

       

      Question:

      Is there a better way then a nested if else if else.... to get to the same answer?

       

      If(mouse_location = red_location) { 'color = red' }

      else {

      if(mouse = orange) { 'color = orange'}

      else {

      if(mouse = yellow) { 'color = yellow' }

      else {

      if(mouse = green) { 'color = green' }

      else {

      if(mouse = blue) {'color = blue'}

      else { 'color = purple'}

      }}}}