Delphi-PRAXiS

Delphi-PRAXiS (https://www.delphipraxis.net/forum.php)
-   Object-Pascal / Delphi-Language (https://www.delphipraxis.net/32-object-pascal-delphi-language/)
-   -   Delphi If Not Problem (https://www.delphipraxis.net/133196-if-not-problem.html)

dutyfree 27. Apr 2009 18:47


If Not Problem
 
Hey, hab ein kleines Problem mit eine If Abfrage, und zwar will ich abfragen wo das Programm liegt und falls es nicht dort liegt soll es dahinkopiert werden.

Delphi-Quellcode:
if not url = 'C:\Test.exe' then CopyFile [...]
Fehler: Operator ist auf diesen Operandentyp nicht anwendbar

Woran liegts? Danke

mkinzler 27. Apr 2009 18:48

Re: If Not Problem
 
Delphi-Quellcode:
if url <> 'C:\Test.exe' then CopyFile [...]

Meflin 27. Apr 2009 18:48

Re: If Not Problem
 
Delphi-Quellcode:
if not (url = 'C:\Test.exe') then CopyFile
Ansonsten wird versucht, das not auf url anzuwenden, was natürlich nicht geht ;)

himitsu 27. Apr 2009 19:20

Re: If Not Problem
 
Schau dir eventuell mal den Abschnitt Delphi-Referenz durchsuchenRangfolge von Operatoren in deiner OH an.

Der NOT-Operator hat Vorrang vor Vergleichsoperatoren und wird somit als Erstes aufgelöst.

ohne Klammern wertet es Delphi also so aus:
Delphi-Quellcode:
if (not url) = 'C:\Test.exe' then


Alle Zeitangaben in WEZ +1. Es ist jetzt 01:36 Uhr.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024 by Thomas Breitkreuz