Module lessons (2/2)
Decisions with IF ed EVALUATE
Branch the execution with IF-ELSE-END-IF and EVALUATE (multiple values, intervals THRU and EVALUATE TRUE) avoiding truncation from the end point.
What you'll learn in this lesson
- Write safe branches with
IF ... ELSE ... END-IF., avoiding the historical midpoint error. - Leverage relational operators and COBOL class tests (
IS NUMERIC,AND,OR,NOT). - Structure clean multiple choices using
EVALUATEon discrete values,THRUintervals, andEVALUATE TRUEcompound conditions.
Overview
Conditional checking in COBOL combines readability similar to spoken English with strict rules about scope terminators. Before 1985, a single misplaced point could alter dozens of lines of logic!
The modern canonical form ends each IF with END-IF (without THEN obligatory, although THEN is tolerated):
Sections covered in this lesson
- 11. Blocks
IF ... ELSE ... END-IF.and the point trap (.) - 22. Relational Operators and Class Tests (
IS NUMERIC) - 33. Multiple selection with
EVALUATE - 4Try it yourself
Unlock "Decisions with IF ed EVALUATE" and the full Course COBOL curriculum
Branch the execution with IF-ELSE-END-IF and EVALUATE (multiple values, intervals THRU and EVALUATE TRUE) avoiding truncation from the end point.
Unlock all 5 hands-on exercises in this lesson plus every advanced WebAssembly module with automated checks.
- Instant access to all advanced modules in Course COBOL plus 17 more courses
- Hands-on browser exercises with automated test suites and solutions
- 14-day money-back guarantee processed via Paddle.com
14-day guarantee · Cancel anytimeModule 1, all 18 interactive games, and cheatsheets are always free.