From the course: COBOL Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Conditional expressions - COBOL Tutorial
From the course: COBOL Essential Training
Conditional expressions
- [Instructor] We often have to make decisions every day. For example, if it's raining, then I want to take an umbrella. This is an example of a conditional expression, which evaluates to either true or false. It's either raining, or it's not. Programming languages work in a similar fashion. They use an if statement. If some condition is true, then execute some statement. Sometimes we want to include an else. If some condition is true, otherwise, execute some other statements. In COBOL, we don't use curly brackets to denote the start and stop of a block of code, but we can use an N verb to help identify when an if statement ends. We can use an "if" and an "else," and then an "end-if." Not only does this help make sure that we're ending at the right spot, it also makes it easier to read. COBOL also allows for nested if statements. This is where an end-if really comes in handy. Other conditional expressions in COBOL…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
Introduction to verbs3m 51s
-
(Locked)
Computational verbs7m 7s
-
(Locked)
Conditional expressions5m 36s
-
(Locked)
Perform statement3m 2s
-
(Locked)
Perform thru2m 30s
-
(Locked)
Perform times5m 9s
-
(Locked)
Challenge: Write code to simulate a cash register4m 13s
-
(Locked)
Solution: Simulated cash register4m 27s
-
-
-
-
-
-
-
-