Hi,
recently I have read the last blog entry and I ask me, why they use 'THEN'
for a whole block !
I think, a 'then' should be for a single line only and a block is without 'THEN'.
example:
if a =b THEN b =a :single line'
if a =b :block
a =10
b =20
end if
additionally, some C expressions would be good:
a += 1
b -= 2
c *= 4
d /= 8
What do you think?
Question
Re: Question
Then is the token that separates the condition and the block. It's a feature seen in many languages that don't require parentheses around the conditional expression.peter wrote:Hi,
recently I have read the last blog entry and I ask me, why they use 'THEN'
for a whole block !
I think, a 'then' should be for a single line only and a block is without 'THEN'.
example:
if a =b THEN b =a :single line'
if a =b :block
a =10
b =20
end if
additionally, some C expressions would be good:
a += 1
b -= 2
c *= 4
d /= 8
What do you think?
And I believe those C expressions were already planned for future versions of CoolBasic.
-
- Moderator
- Posts: 1583
- Joined: Mon Aug 27, 2007 11:24 pm
- Location: Otaniemi - Mikkeli -pendelöinti
Re: Question
I don't know if it's a bug or a planned feature, but in CoolBasic Beta #10 it works with and without - having a 'then' is optional with multiline ifs. Having (undocumented) optional features like that might be confusing to the programmers, though.
Re: Question
thanks esa94,
I know this behaviour of some Baisc dialects.
But I programs in some other Basic dialects, which need not
round brackets and 'THEN' for an 'IF block !
I know this behaviour of some Baisc dialects.
But I programs in some other Basic dialects, which need not
round brackets and 'THEN' for an 'IF block !
- Zero
- Lead Developer
- Posts: 727
- Joined: Sun Aug 26, 2007 2:30 pm
- Location: Helsinki, Finland
- Contact:
Re: Question
Usage of the "Then" keyword greatly varies between different BASIC dialects; some compilers consider it optional for an If-block, but require it for a single line statement. Since there are dozens of BASIC languages out there, we have decided to follow the same design as the "most used" BASIC which is Visual Basic. Also, this particular behavior is the same in both VB6 and modern VB.NET.
CoolBasic henkilökuntaa
Johtava Suunnittelija
CoolBasic V3, CoolBasic Classic
http://www.coolbasic.com/blog
Johtava Suunnittelija
CoolBasic V3, CoolBasic Classic
http://www.coolbasic.com/blog
Re: Question
Thanks Zero for this clarification.
I think that I must say some Basic dialects ,go home!
It's really too much to write in so many program languages.
I love VB, but less VB NET!
Peter
I think that I must say some Basic dialects ,go home!
It's really too much to write in so many program languages.
I love VB, but less VB NET!
Peter