Recent

Author Topic: Try...except statement  (Read 2113 times)

stansbkg

  • New Member
  • *
  • Posts: 28
Try...except statement
« on: November 13, 2017, 08:15:47 pm »
I am running
Free Pascal IDE for win32 for i386
Version 1.0.12
Compiler version 3.0.2

I wish to use the "try...except" statement.
But I get the compiler error:  Identifier not found "try"

What needs to be done?

howardpc

  • Hero Member
  • *****
  • Posts: 4144
Re: Try...except statement
« Reply #1 on: November 13, 2017, 08:25:54 pm »
You may need to share the section of faulty code.
Perhaps you forgot to complete the Pascal statement before "try" with a semicolon?

rvk

  • Hero Member
  • *****
  • Posts: 6112
Re: Try...except statement
« Reply #2 on: November 13, 2017, 08:39:30 pm »
I wish to use the "try...except" statement.
But I get the compiler error:  Identifier not found "try"
You are in plain FPC or TP-mode.

If you want to use try/except/finally you need to add the following line under your program-line.
Code: Pascal  [Select][+][-]
  1. {$mode objfpc}
It switched to ObjFPC mode which supports try/except/finally.

https://www.freepascal.org/docs-html/prog/progap4.html#progse75.html
« Last Edit: November 13, 2017, 08:42:16 pm by rvk »

 

TinyPortal © 2005-2018