

Creator II
2020-02-09
12:08 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
what is the correct syntax for endif?
Hi,
I'm using an if...then statement and I was wondering what the correct syntax to end it would be.
The help says it is 'end if' -> with space and semicolon
The autocomplete suggests 'endif'
So my question is:
- do I need to use a space between endif, or does it make a difference?
- do I need to use a semicolon afterwards?
- do I need to use endif AT ALL (cause it seems to work witout it)
I was just trying something simple like:
if ComputerName() = '01.....' then
SET test = 1;
Else
SET test = 2;
END IF
Appreciate any help. Thanks!
2,678 Views
1 Solution
Accepted Solutions

Partner - Champion III
2020-02-09
01:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- No it doesn't matter - you are free to use either ENDIF or END IF
- No you don't need a semicolon afterwards. It belongs to the group of script statements called "control statements" they have to stay on a single line and will be terminated either by a new line or a semicolon which is optional.
- QlikView doesn't complain although it is a bit odd - the result is that all the rest of the load script belongs to the ELSE part. So it is a pretty bad idea leaving ENDIF out.
1 Reply

Partner - Champion III
2020-02-09
01:00 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- No it doesn't matter - you are free to use either ENDIF or END IF
- No you don't need a semicolon afterwards. It belongs to the group of script statements called "control statements" they have to stay on a single line and will be terminated either by a new line or a semicolon which is optional.
- QlikView doesn't complain although it is a bit odd - the result is that all the rest of the load script belongs to the ELSE part. So it is a pretty bad idea leaving ENDIF out.
