An endoscope is a medical instrument used to view the inside of the body without performing major surgery. It is composed of an image sensor, optical lens, light source, and mechanical device, and is inserted into the body through natural openings such as the mouth, urethra, or anus. The endoscopes length and flexibility depend on the part of the body the doctor needs to see, and it can be used to diagnose diseases in various parts of the body, including the esophagus, stomach, colon, ears, nose, throat, heart, urinary tract, and joints. Endoscopes use tubes that are only a few millimeters thick to transfer illumination in one direction and high-resolution images in real-time in the other direction, resulting in minimally invasive surgeries. During an endoscopy, the doctor can insert tools through a channel in the endoscope to collect tissue samples or provide treatment. Endoscopes have been developed for many parts of the body, and each has its own name depending on the part of the body it is intended to investigate. An endoscopy offers an opportunity to collect tissue samples (biopsy) to test for diseases and conditions that may be causing anemia, bleeding, inflammation, or diarrhea. It can also detect some cancers of the upper digestive system.