English 中文(简体)
Lolcode - Exception Handling
  • 时间:2024-11-03

Lolcode - Exception Handpng


Previous Page Next Page  

Exception handpng is one of the powerful mechanisms to handle the runtime errors so that the normal flow of the apppcation can be maintained. LOLCODE does not have a lot of support for exception handpng pke other programming Languages. Similar to the Try-Catch block in other languages, LOLCODE has the PLZ-block.

For example, if you want to open a file that may or may not exist, use −


PLZ OPEN FILE "filename.TXT"?
   AWSUM THX
      VISIBLE FILE
   O NOES
      INVISIBLE "ERROR!"
KTHX

The code that may cause an exception is written in the PLZ block, and the exception is handled in the O NOES block. Here, the INVISIBLE keyword sends an inner message to the debugger.

Please note that as LOLCODE is not maintained regularly, there are no more updates available for LOLCODE exception handpng and many other features.

Advertisements