![]() |
Exception in Funktion einbauen...
Hallo,
ich habe eine Funktion, hier mal ein Beispiel:
Delphi-Quellcode:
Wie kann ich sowas nun realisieren?
function test(text: string): boolean;
begin if text='hallo' then result:=true else begin result:=false; {hier soll jetzt eine Exception erzeugt werden (mit nem Bestimmen Text, z.B. "Text nicht richtig"} end; end; |
Re: Exception in Funktion einbauen...
Delphi-Quellcode:
so z.B. ;)
type
EWrongText = class(Exception) end; function test(text: string): boolean; begin if text = 'hallo' then result:=true else begin result :=false; raise EWrongText.Create('Text nicht richtig'); end; end; mfG mirage228 |
Alle Zeitangaben in WEZ +1. Es ist jetzt 10:27 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz