And, Or, Not?

Just starting out? Need help? Post your questions and find answers here.
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by flim.

is the Not operator exist?
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

i dont think so

I tried:

while not eof(0)
...
wend

Just like AmiBlitz.

instead I had to use:

while eof(0)=0
...
wend

That looks stupid but works...

But Fred: please add it!
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Danilo.

Fred said he´ll add it for the next version
(should come within the next days).

cya,
...Danilo

(registered PureBasic user)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

I hope the new version also contains "then" (if...then...) and "ElseIf".
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
I hope the new version also contains "then" (if...then...) and "ElseIf".
Well, 'ElseIf' would be nice, but why 'Then'?

Code: Select all

If a=10 Then
  do something
EndIf
is the same as:

Code: Select all

If a=10 
  do something
EndIf
I think 'Then' is really not needed to understand the code...

Have a nice day...
Franco

Edited by - franco on 27 December 2001 21:22:58
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by PB.

Code: Select all

If a=10 
  do something
EndIf
You don't understand, Franco -- using Then means you can replace the above
three lines with one line: If a=10 Then do something. You don't need EndIf
when using Then. It stops simple code being spread over many lines, which
can sometimes be a hassle.

Edited by - PB on 27 December 2001 21:37:34
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

PB: yes, that`s what I wanted to say!

Why complicated when you can make it simple?
One line says it all: "If a=1 then b=1"

Franco: do you really think this is better:?

if a=1
b=1
endif


"Then" makes your code much more readable. And it`s a "Basic"-Keyword since 20 years and more).
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Paul.

I don't know... there doesn't seem to be much of a savings between

Code: Select all

If a=10 Then b=20
and

Code: Select all

If a=10:b=20:Endif
I wish more versions of BASIC would drop the 'THEN' statement.
Personal preference I guess :)
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by Franco.
You don't understand, Franco -- using Then means you can replace the above
three lines with one line: If a=10 Then do something. You don't need EndIf
OK PB, I understand.
I didn't use a Basic dialect before that uses 'Then' in that way.
I know BCX-basic, there it goes:

Code: Select all

If a=10 Then
  do something
EndIf
And I know another Basic there it goes:

Code: Select all

Case a=10 : do something
(without a 'Select' command before and 'EndSelect' after!)

instead of:

Code: Select all

If a=10 : do something : EndIf
But I suppose this don't work with PureBasic...



Have a nice day...
Franco
BackupUser
PureBasic Guru
PureBasic Guru
Posts: 16777133
Joined: Tue Apr 22, 2003 7:42 pm

Post by BackupUser »

Restored from previous forum. Originally posted by redacid.

"If a=10 : do something : EndIf"

This works. But with "then" it would be even more readable.
Post Reply