IF THEN Statements
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-11-29
03:01 AM
- last edited on
‎2024-09-26
01:43 PM
by
Doreena Deng
Hi,
If I write and IF THEN statement, the editor sometimes returns an error if I add an ENDIF on the next line. Most of the time it seems to run without error if I don't even add the ENDIF statement when creating a list of logic.
The editor seems to like ENDIF after a series of parameters e.g:
IF list = 0 THEN
item = 1
method = 2
ENDIF
The Editor has no fault with no ENDIF after the following logic:
IF list = 0 THEN item = 0
IF list = 1 THEN item = 1
IF list = 1 THEN item = 1
Is there a clue as to when an ENDIF is required?
Many thanks, Matt
Solved! Go to Solution.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-11-29 03:46 AM
When the IF, THEN, command is all on the same line, you do not need the ENDIF (I still put it there anyway).
When the command is on a separate line, you must use ENDIF.
Barry.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-11-29 03:46 AM
When the IF, THEN, command is all on the same line, you do not need the ENDIF (I still put it there anyway).
When the command is on a separate line, you must use ENDIF.
Barry.
Versions 6.5 to 27
i7-10700 @ 2.9Ghz, 32GB ram, GeForce RTX 2060 (6GB), Windows 10
Lenovo Thinkpad - i7-1270P 2.20 GHz, 32GB RAM, Nvidia T550, Windows 11
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-11-29 12:14 PM - edited ‎2023-11-29 12:16 PM
if condition has only one statement and (as Barry mentioned) then is on the same line, you don't need endif
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎2023-11-29 01:47 PM
That is helpful. It was one of those unknowns that is very pleasing to have a definitive answer to.
Thank you both Barry and A_Smith for your responses!