EXIT closes the entire script

Software EleganceCode Complexity

Why you should care

EXIT instruction is designed to exit the entire script hence the purpose of having only one instruction at a time. EXIT instruction has the capability of causing some of the script to be unread if placed incorrectly. As a result, the script will have compilation errors.

Business Impacts

EXIT is an instruction that can add complexity if not used properly which results in a loss of time that could be used towards innovating the script instead.

Acceleration
5362

CAST Recommendations

References

https://www.geeksforgeeks.org/system-exit-in-java/

Style Guide

How we detect

This Code insight suggests that only one EXIT instruction should be present, and if possible, it should be the last instruction of the script.
5362

About CAST and Highlight’s Code Insights

Over the last 25 years, CAST has leveraged unique knowledge on software quality measurement by analyzing thousands of applications and billions of lines of code. Based on this experience and community standards on programming best practices, Highlight implements hundreds of code insights across 15+ technologies to calculate health factors of a software.

See featuresHow it works