Programmers may not be the guys with the best sense of humor around, but I found it quite entertaining to read a web page with a collection of source code comments arising a smile.

The one I liked the most is the following - not even a comment, but the way the guy called the object he instantiates:


I am sorry if you do not get it - let me try to explain. A program may "throw an exception" if something goes wrong - say it finds itself in the need of dividing by zero, or taking the square root of a negative number, or accessing a non-existing memory address. The language has a command that "throws" the exception, and the exception may have a text attached or other characteristics, which are specified by its constructor command. The code above "throws" the exception called "up", so the code does contain the command "throw up"....

Others might like more the other code segments in the page linked - worth a visit.

Old NID
137558

Donate

Please donate so science experts can write for the public.

At Science 2.0, scientists are the journalists, with no political bias or editorial control. We can't do it alone so please make a difference.

Donate with PayPal button 
We are a nonprofit science journalism group operating under Section 501(c)(3) of the Internal Revenue Code that's educated over 300 million people.

You can help with a tax-deductible donation today and 100 percent of your gift will go toward our programs, no salaries or offices.

Latest reads

Article teaser image
Donald Trump does not have the power to rescind either constitutional amendments or federal laws by mere executive order, no matter how strongly he might wish otherwise. No president of the United…
Article teaser image
The Biden administration recently issued a new report showing causal links between alcohol and cancer, and it's about time. The link has been long-known, but alcohol carcinogenic properties have been…
Article teaser image
In British Iron Age society, land was inherited through the female line and husbands moved to live with the wife’s community. Strong women like Margaret Thatcher resulted.That was inferred due to DNA…