Endoscopy can be both diagnostic and therapeutic. In other words, endoscopy allows your doctor to identify and determine how to best treat conditions that appear in the upper or lower part of your digestive system. Endoscopy is the best means of early detection for several forms of cancer.