Is basic a single line single instruction code language?
Is basic a single line single instruction code language?
Am new to purebasic.
Currently learning to do basic programming in purebasic.
I tried to have multiple instructions codes in a single line e.g.
a$=B$:X=1
or dim a(100), b(200)
etc
Purebasic gives an error . Is there a syntax to do this or purebasic is a single line singe instruction code language?
btw....
Can someone from the Purebaisc adm help?
I tried to order the licence today for Euro 79 thru this site, but was refused for reasons :security reasons.
I checked with my citibank credit card div. they said there is no issue with my card. So what is the other althernative to pay? I I use paypal?
I am from Malaysia. Is it because they refuse purchases from Malaysia?
Regards
Alan
Currently learning to do basic programming in purebasic.
I tried to have multiple instructions codes in a single line e.g.
a$=B$:X=1
or dim a(100), b(200)
etc
Purebasic gives an error . Is there a syntax to do this or purebasic is a single line singe instruction code language?
btw....
Can someone from the Purebaisc adm help?
I tried to order the licence today for Euro 79 thru this site, but was refused for reasons :security reasons.
I checked with my citibank credit card div. they said there is no issue with my card. So what is the other althernative to pay? I I use paypal?
I am from Malaysia. Is it because they refuse purchases from Malaysia?
Regards
Alan
- Michael Vogel
- Addict
- Posts: 2797
- Joined: Thu Feb 09, 2006 11:27 pm
- Contact:
Okay, the security issues should be checked by the PB-Team...
...but I can give you an answer to your single instruction line question: yes and no
Yes - each Purebasic instruction has to be separated, so IF a<10 THEN a=a+1 ENDIF is not allowed (in a single line)
No - you can use the colon ( : ) as a separator as well, so IF a<10 : a+1 : ENDIF will work
BTW your a$=B$:X=1 example should also work without an error (at least with all Purebasic versions I've used so far
Hope you'll be able to get Purebasic soon, I'm quite sure you'll like it,
Michael
...but I can give you an answer to your single instruction line question: yes and no

Yes - each Purebasic instruction has to be separated, so IF a<10 THEN a=a+1 ENDIF is not allowed (in a single line)
No - you can use the colon ( : ) as a separator as well, so IF a<10 : a+1 : ENDIF will work
BTW your a$=B$:X=1 example should also work without an error (at least with all Purebasic versions I've used so far
Hope you'll be able to get Purebasic soon, I'm quite sure you'll like it,
Michael
- Joakim Christiansen
- Addict
- Posts: 2452
- Joined: Wed Dec 22, 2004 4:12 pm
- Location: Norway
- Contact:
This is also okay:
Code: Select all
Define value.l=22, string$ = "hello", whatever=12
I like logic, hence I dislike humans but love computers.
But... the question is: do you WANT multiple instructions per line?
I think it's a horrible way to keep your code readable, but then again I have been known for having my own opinions
http://www.xs4all.nl/~bluez/datatalk/pure4.htm#1_style

I think it's a horrible way to keep your code readable, but then again I have been known for having my own opinions

http://www.xs4all.nl/~bluez/datatalk/pure4.htm#1_style

( 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... )
( The path to enlightenment and the PureBasic Survival Guide right here... )
Thansk micheal for the reply.
Yes, tried it and it works. Must have been other syntax issues when I got the error.
Regards
Alan
As for payment for purebasic, hope someone from Purebasic adm will help.
Am very eager to use Purebasic for my projects. Love the examples...:>)
and the good support from fello users here.
Yes, tried it and it works. Must have been other syntax issues when I got the error.
Regards
Alan
As for payment for purebasic, hope someone from Purebasic adm will help.
Am very eager to use Purebasic for my projects. Love the examples...:>)
and the good support from fello users here.
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
only if you keep the lines short enough not to need to scroll horizontally.UserOfPure wrote:It sure beats scrolling to read your code!blueznl wrote:But... the question is: do you WANT multiple instructions per line?
but in general, I prefer having Ifs and such multilined.
oh... and have a nice day.
About the payment, email Fred on this address: alphasnd@purebasic.com.
- John Puccio
- User
- Posts: 26
- Joined: Fri Jun 12, 2009 6:56 am
- Location: My Keyboard
Well Alan, you've come to the right language. Single line coding is considered to be poor style. As your code grows and you gain experience you will no longer do this.
a$=B$:X=1
instead you will do this
a$ = B$
X = 1
There are exceptions of course, but generally speaking it's not a good way to code. The above code is not a good example because it's too short to make the point. Do a search on the PurePunch contest read the rules. Then unzip the files and look at the source's and you will understand why. Welcome to PURE!

JP
a$=B$:X=1
instead you will do this
a$ = B$
X = 1
There are exceptions of course, but generally speaking it's not a good way to code. The above code is not a good example because it's too short to make the point. Do a search on the PurePunch contest read the rules. Then unzip the files and look at the source's and you will understand why. Welcome to PURE!
You could always set your type size to really really small..Kaeru Gaman wrote:only if you keep the lines short enough not to need to scroll horizontally.UserOfPure wrote:It sure beats scrolling to read your code!blueznl wrote:But... the question is: do you WANT multiple instructions per line?

JP
-
- Enthusiast
- Posts: 469
- Joined: Sun Mar 16, 2008 9:18 am
Code: Select all
Protected a.l, b.l
Global throttle_limit.l, torque.l, driver_name.s
Code: Select all
Protected a.l
Protected b.l
Global throttle_limit.l
Global torque.l
Global driver_name.s

Last edited by UserOfPure on Wed Sep 02, 2009 11:54 am, edited 1 time in total.
- Kaeru Gaman
- Addict
- Posts: 4826
- Joined: Sun Mar 19, 2006 1:57 pm
- Location: Germany
one has to know metes and bounds.
normal Ifs: give it one line per Command.
really short Ifs: put it in one line.
Declarations: group by type and purpose.
"Readability" is not carved in stone, it's a dynamic thing and changes from situation to situation.
normal Ifs: give it one line per Command.
really short Ifs: put it in one line.
Code: Select all
If X > 639 : X = 0 : EndIf
Code: Select all
Define.l MX, MY, MBL0, MBR0, MBL1, MBR1
Define.l PlX, PlY
Define.l DpX, DpY
Define.d ShX, ShY, Speed
Define.l EngFlg
Define.l Rotation, RotSpd, RotPhs
Define.d RadaX, RadaY, RadaP
Define.l RadarRot, RadaC
oh... and have a nice day.
As with Purebasic we can't assign multiples values in one line, I think it sometimes could be convenient to do things like that .
Code: Select all
x = 1.0 : y = 1.0 : z = 1.0
using Global you can write :
or Protected in a procedure :
Code: Select all
Global Dim a(100), Dim b(200)
Code: Select all
Procedure toto()
Protected Dim a(100), Dim b(200)
EndProcedure
Please correct my english
http://purebasic.developpez.com/
http://purebasic.developpez.com/
-
- Addict
- Posts: 4775
- Joined: Thu Jun 07, 2007 3:25 pm
- Location: Berlin, Germany
djes wrote:As with Purebasic we can't assign multiples values in one line, I think it sometimes could be convenient to do things like that.Code: Select all
x = 1.0 : y = 1.0 : z = 1.0

We can do that. Your code works fine here with the current version 4.31 (Windows).
Regards, Little John
Maybe he meant something like:Little John wrote:djes wrote:As with Purebasic we can't assign multiples values in one line, I think it sometimes could be convenient to do things like that.Code: Select all
x = 1.0 : y = 1.0 : z = 1.0
We can do that. Your code works fine here with the current version 4.31 (Windows).
Code: Select all
x, y, z = 1.0