Tip: If/Then in PureBasic!

Share your advanced PureBasic knowledge/code with the community.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

lol
@}--`--,-- A rose by any other name ..
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Post by Trond »

PB wrote:> Now tell me, where did you see an implementation of then which behaves
> similar to this macro? Big prize if you can!

Here's two implementations: VB and C64. Now, where's my prize? :twisted:
I already explained why it does not behave similar to VB's then.

It is not equal to Commodore 64 Basic V2 because if a then is followed by a line number on Commodore, it is interpreted as a conditional goto, jumping to the line number after then. (In PB this would be a label.)

Note that I'm not saying that this then is useless (well it is, but I'm not saying it (oups)), I simply asked where this version of then came from and no one really knew.

But we all want progress to the better, don't we? So I'm not saying that this macro shouldn't be use because it doesn't match other languages, actually more to the opposite. When the statements are surrounded by parentheses, this prevents errors because there is less confusion of which statements are effected by the if statement and which aren't.

But that doesn't make it's behaviour similar to other languages.

Prize: Image
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Dare2 wrote: But if you have a beer to hand, quaff that. :)
Edit: And shoot rings. Or - ooga booga - club him senseless. He started it. :P :lol:
quaffing... ah yes, the fine art of spilling beer without drinking it!

and clubbing! loud music, barely dressed girls! flashy lights! and more quaffing!

unless the finer point of your message escaped me... and you were talking about something totally different... <puzzled look>
Last edited by blueznl on Wed Mar 22, 2006 10:28 pm, edited 2 times in total.
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

Dare2 wrote: I was just thinking - a novel approach for me
apocalypse is upon us!
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> It is not equal to Commodore 64 Basic V2 because if a then is followed
> by a line number on Commodore, it is interpreted as a conditional goto

True, the C64 can interpret If/Then in that way. But I meant it to be used
in the traditional sense, especially considering that PureBasic doesn't use
line numbers by default.

> I simply asked where this version of then came from and no one really knew

We old-schoolers know perfectly well where it came from. :)

> Prize: Image

:lol: Thanks!
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
Dare2
Moderator
Moderator
Posts: 3321
Joined: Sat Dec 27, 2003 3:55 am
Location: Great Southern Land

Post by Dare2 »

lol.

Clubs blueznl using a catchy beat - ooga ooga! :)
@}--`--,-- A rose by any other name ..
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

I read this, thanks PB for your tip. :)

<the most amazing thing about this whole thread to me was that you still had a C-64 around :) >
User avatar
blueznl
PureBasic Expert
PureBasic Expert
Posts: 6166
Joined: Sat May 17, 2003 11:31 am
Contact:

Post by blueznl »

either that or an emu :-)

but i DO have a vic20 here, does that count as well?
( PB6.00 LTS Win11 x64 Asrock AB350 Pro4 Ryzen 5 3600 32GB GTX1060 6GB)
( The path to enlightenment and the PureBasic Survival Guide right here... )
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

@SFSxOI: I was using this -> www.ccs64.com :)

But there's also this online Java version: http://www.dreamfabric.com/c64/
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
SFSxOI
Addict
Addict
Posts: 2970
Joined: Sat Dec 31, 2005 5:24 pm
Location: Where ya would never look.....

Post by SFSxOI »

WoW! I didn't realize that people were still interested in the C-64, at least to the point of actually creating an emulator for it. I had a C-64 (and a Vic-20, and a TI-99, and a TRS-80, and a PET, and an Apple) years ago when they first came out
techjunkie
Addict
Addict
Posts: 1126
Joined: Wed Oct 15, 2003 12:40 am
Location: Sweden
Contact:

Post by techjunkie »

SFSxOI wrote:WoW! I didn't realize that people were still interested in the C-64, at least to the point of actually creating an emulator for it. I had a C-64 (and a Vic-20, and a TI-99, and a TRS-80, and a PET, and an Apple) years ago when they first came out
http://www.emulator-zone.com/
http://www.viceteam.org/
http://en.wikipedia.org/wiki/List_of_emulators
http://www.wbwip.com/a2web/a2emul.html

:D
Image
(\__/)
(='.'=) This is Bunny. Copy and paste Bunny into your
(")_(") signature to help him gain world domination.
Post Reply