inportb

The OK Function

by Jiang on May.04, 2009, under Computing

I encountered a most awesome function today; it’s called OK.

OK accepts no arguments and returns either true or false. When a program needs to make a decision, it could ask if it’s OK or not. Interesting? You bet. But this is only half of the story. How does OK work?

When OK is called, it saves a snapshot of the current program execution state and returns true; it also installs a hook so that it is called at the end of the program. If the program ends successfully, OK does nothing. If the program fails, on the other hand, OK recalls the saved state and returns false.

Hmm…

Popularity: 1%

3 comments for this entry:
  1. antimatter15

    You’re the fourth result on a google search for “ok function”

  2. antimatter15

    and what languages implement OK?

  3. Jiang Yio

    Hm… there are better languages for this, but: http://www.110mb.com/forum/-t45974.0.html

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!