1
1
Fork 0
mirror of https://github.com/QB64-Phoenix-Edition/QB64pe.git synced 2024-07-06 00:00:22 +00:00
QB64-PE/internal/help/$ERROR_$11111.txt
Roland Heyder 6912727753 Update help files
Help file snapshot as of 07/31/2022.
2022-07-31 23:57:56 +02:00

38 lines
1.3 KiB
Plaintext

{{QBDLDATE:07-31-2022}}
{{QBDLTIME:23:37:38}}
The '''$ERROR''' [[metacommand]] triggers a compilation error.
{{PageSyntax}}
: '''$ERROR''' {{Parameter|message}}
{{PageDescription}}
* This metacommand does not require a comment ''[[Apostrophe|']]'' or [[REM]] before it.
* {{Parameter|message}} is any text. Quotation marks are not required.
* When QB64 tries to compile an '''$ERROR''' metacommand a compilation error is triggered and {{Parameter|message}} is shown to the user. This is useful in [[$IF]] blocks.
{{PageDescription}}
* If there is a particular situation where you know your program will not work properly, you can prevent the user compiling and give them a helpful error message instead by checking for the condition with [[$IF]].
* An '''$ERROR''' directive not inside an conditional [[$IF]] (or [[$ELSEIF]]) block is useless because the program will '''never''' compile in that case.
{{PageExamples}}
{{CodeStart}}
{{Cl|$IF}} VERSION < 2.1 OR WINDOWS = 0 THEN
{{Cl|$ERROR}} Requires Windows QB64 version 2.1 or above
{{Cl|$END IF}}
{{CodeEnd}}
;Output (IDE Status Area):Compilation check failed: REQUIRES WINDOWS QB64 VERSION 2.1 OR ABOVE on line 2 (assuming your version of QB64 doesn't meet those requirements).
{{PageSeeAlso}}
* [[Metacommand]]
* [[$IF]]
{{PageNavigation}}
[[Category:Final]]