IF THEN

Previous topic - Next topic

Kitty Hello

I won't touch it.

IF xxx THEN _one_command_
IF xxx; _more_commands_; ENDIF

That's the way it is. With options and whatnot, the language get more and more complicated and copy/paste code won't work.
I "might" think about having more commands in one single line act on the same THEN command, but I think it's not easy to implement, since the GLBasic GPC does not distinguish between ; and \n.

Crivens

If it's not easy implement then don't worry about it. I only noticed it because I was being lazy with logging script on one line, and it took a while to trace the problem down. Although it could put off people coming from other Basics (most noticeably VB) who don't realise this is the case.

Out of interest, if multiple commands on one line is seen as messy and avoided most of the time (I only found out by chance after assuming it didn't do multiple commands on one line when colon didn't work. Amusing considering one of the main basics I've used for 16 years uses semi-colons) then won't this be a very minimal hit on old code if the end of line is used as an automatic ENDIF rather than the end of the first command?

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

Moru

Quote from: Crivens on 2011-Jun-28
... then won't this be a very minimal hit on old code if the end of line is used as an automatic ENDIF rather than the end of the first command?

Quote from: KittyHello
but I think it's not easy to implement, since the GLBasic GPC does not distinguish between ; and \n.

I think that's a "no" :-)
As I understand it, the compiler does not see a difference between end-of-line character and a ; so no way of inserting an ENDIF after end-of-line char only.

Crivens

Yeah, but I say these things everyday to customers but sometimes have a think and come up with a cunning method. Never know...

Cheers
Current fave quote: Cause you like musicians and I like people with boobs.

hardyx

I like the "IF condition; commands; ENDIF" form.