If... Then?

BlitzPlus Forums/BlitzPlus Beginners Area/If... Then?

InvincibleWall(Posted 2010) [#1]
I have been using B+ for about a month now and just found the Then function in the command reference. It says it is used to end the If statements... but i haven't used it once

If it ends the If statements then why does it not give an error saying expecting end of statement? Does the Then make the code run faster? Is it for people reading it? What is it's purposed?

thanks in advance for your help


xlsior(Posted 2010) [#2]
'then' really is a legacy command, which has been around sinc ethe dawn of BASIC. Most basic programmers would expect to have to type 'then', even though it's optional in Blitz.

Use it or skip it, whatever your personal preference.

Using 'then' does make the code flow more like natural English, potentially making it a little easier for people to understand what's happening in the program.


Sauer(Posted 2010) [#3]
Although not an official convention, generally Then is used when condensing if statements into single lines. Something like
If a=4 Then Print a


It makes it a bit more readable but that's about it.