IF.. ELSE.. ENDIF, an Epiphany, and some Seriously Fun Facts
- prateetisengupta

- Nov 17, 2018
- 3 min read
“… this is very important, so please pay attention. In this session we are going to focus on two of the most basic programming constructs that are used in all programming languages, namely, conditional statements:- IF.. ELSE.. ENDIF and CASE..ENDCASE…” The year is 1992. It is the second day of the Programming Logic and Techniques (PLT) module of the course I am attending at NIIT and our coordinator is writing something on the whiteboard that looks like some sort of diagram in words:- IF Condition1 THEN Step1; Step2; ELSIF Condition2 THEN Step3; Step4; ENDIF;
CASE Condition1 Step1; Step2; CASE Condition2 Step3; Step4; ENDCASE;
“Yesterday we saw how decision boxes are used in flow charts”, she continued. “Decision boxes help us to evaluate conditions and take some action based on the outcome. And how do we incorporate these in our programs so that the machine knows what to do when it encounters such a condition?” She pauses and looks questioningly at us. “Any ideas?” “With an ‘IF’ statement, like what you have written on the board?” someone hazards a guess. “Yes, that’s right. With an ‘IF..ELSE’ or a ‘CASE..ENDCASE’ construct we can specify any condition we want the computer to check, and based on the result we can give it any instructions we want it to execute…” My mind wanders a little, because it all seems vaguely familiar. Where have I read or heard or seen something like this before? It sounds very similar to the deductive syllogisms I had to solve as part of my undergraduate Philosophy pass course …but not quite. And then it suddenly strikes me like a bolt of lightning, right out of the blue. In a trice, I am transported back in time. It is the year 1986, the place is Room#23 of the English Department, Presidency College, Kolkata, and I am listening to a lecture on ……none other than Andrew Marvell, and “To His Coy Mistress”. Of course! I repeat the lines in my head and I see with amazing clarity the underlying structure, so simple and elegant: “Had we but world enough and time, This coyness, lady, were no crime. We would sit down, and think which way To walk, and pass our long love’s day…. …….. But at my back I always hear Time’s wingèd chariot hurrying near; And yonder all before us lie Deserts of vast eternity….. ……… Now therefore, while the youthful hue Sits on thy skin like morning dew, And while thy willing soul transpires At every pore with instant fires, Now let us sport us while we may, And now, like amorous birds of prey, Rather at once our time devour Than languish in his slow-chapped power…. …….. Thus, though we cannot make our sun Stand still, yet we will make him run.”
When translated into programming language, what Marvell is really saying is:-
CASE We have sufficient time and space ….Condition1 Take it really slow and steady; …..Step(s) CASE We do not have sufficient time and space ..…Condition2 Make the best use of the limited resources at our disposal; …..Step1 And make them count (i.e., Carpe Diem) …..Step2 ENDCASE;
It is a revelation; an unforgettable experience. ………….
And now for some fun trivia, and I am sure all my readers already know them:- The terms “Yahoo” and “Big-endian” were coined by Jonathan Swift in his “Travels into Several Remote Nations of the World. In Four Parts. By Lemuel Gulliver, First a Surgeon, and then a Captain of Several Ships”, commonly known as “Gulliver's Travels” (1726, amended 1735). Little did he know that the first would be taken over by an Internet search engine, and the second would (conceptually speaking) give rise to two different styles of representing byte orders in a digital word in computer memory! And when Sir Thomas More penned his “Utopia” (which literally means ‘no place’) in 1516, I am sure he did not have a data services solution in mind. Evolution of computer terminology could very well become a branch of Philology in the future!
Read Marvell’s “To His Coy Mistress” at:- https://www.poetryfoundation.org/poems-and-poets/poems/detail/44688








Comments