Who here likes the BASIC syntax and why ? If notTHENwhichDO?

Everything else that doesn't fall into one of the other PB categories.
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Who here likes the BASIC syntax and why ? If notTHENwhichDO?

Post by Primoz128 »

Well i am just wondering how many of you like BASIC syntax and for what reason, i personally am crying about it ;( i want c++ one... brackets ftw...

So ?
User avatar
STARGÅTE
Addict
Addict
Posts: 2315
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by STARGÅTE »

I like it, because all commands have their own end keywords. So it is easier to read than many heaps like } } }.

Basic just looks nicer than C++ syntax!
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

Next.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Foz »

It's a hell of a lot easier to read and comprehend - especially when trying to understand what is going on.

Take an example I came across a couple of years ago:

Code: Select all

for(double Amplitude=1; (Octaves--) && (Amplitude>1/256.); Amplitude*=Persistence, Frequency<<=1) {
// code
}
Now lets take the PureBasic translation:

Code: Select all

Amplitude.d=1.0
amp.d = 1/256
While Octaves And Amplitude > amp
  Octaves - 1
  Amplitude * Persistence
  Frequency << 1

  ; code
Wend 
I haven't touched high level math since I was at uni and can't remember for the life of me what a lot of the symbols are. So instead of reading reams of white papers that I can't understand and get bored of, I rely on reading code to understand what it is actually doing.

If I was writing in C/C++, I would have to comment every line, and if I have to comment every line of code to understand it, I might as well as write in pure ASM instead.

If you can write something like that C/C++ statement and in a year glance at it and say "yup, I understand what that's doing", then yes, stick to C/C++.

For the rest of us mere mortals, there is PureBasic
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

Foz wrote:It's a hell of a lot easier to read and comprehend - especially when trying to understand what is going on.

Take an example I came across a couple of years ago:

Code: Select all

for(double Amplitude=1; (Octaves--) && (Amplitude>1/256.); Amplitude*=Persistence, Frequency<<=1) {
// code
}
Now lets take the PureBasic translation:

Code: Select all

Amplitude.d=1.0
amp.d = 1/256
While Octaves And Amplitude > amp
  Octaves - 1
  Amplitude * Persistence
  Frequency << 1

  ; code
Wend 
I haven't touched high level math since I was at uni and can't remember for the life of me what a lot of the symbols are. So instead of reading reams of white papers that I can't understand and get bored of, I rely on reading code to understand what it is actually doing.

If I was writing in C/C++, I would have to comment every line, and if I have to comment every line of code to understand it, I might as well as write in pure ASM instead.

If you can write something like that C/C++ statement and in a year glance at it and say "yup, I understand what that's doing", then yes, stick to C/C++.

For the rest of us mere mortals, there is PureBasic
The code you poped is very poorly organised you know. It's not PB's nature of being that nicely organised it's just how the programer organised it.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Foz »

Yes, and the code was written by a mathematical genius.

And this is my point - C, C++, C#, Java, PHP, Perl, etc does not lend itself to readable and understandable code.
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

Foz wrote:Yes, and the code was written by a mathematical genius.

And this is my point - C, C++, C#, Java, PHP, Perl, etc does not lend itself to readable and understandable code.
You are mistaken, it's only the way a person prefers, i can make my code of for example 500 lines of code so good for me that in just a minute i understand it completely, while if you gave me BASIC one of such length i would definetly need hours to be able to understand it just partly, but that's not because of BASIC is not the way i like it but because codes are usually poorly coded. For example even c++ code can be very ugly it's because people just spam brackets and never organise, making it really difficult to read.

I think i complicated it... but i like c++ one because it takes only 1 character to write a start or end block, where as in Pure Basic damn 4 for an if end y.y.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Foz »

Let's take a simple example:

Code: Select all

int a = 1;
int b = 1;
int c = 3;
If((a == 1 && b == 2) || c == 3) {
  // code
}
vs

Code: Select all

a = 1
b = 1
c = 3
If (a = 1 And b = 2) Or c = 3
  ; code
EndIf
Now, you have to explain the code to someone from the ground.
Let us start with C:
Okay, first we have to declare our variables, and we are also assigning the values to them, so a equals 1, b equals 1, etc. Note that the semi colon is required to mark the line as then end of a coding line - every line unless it ends with a parenthesis or a comment.
Then we have a decision branch - the If statement. Now all decisions HAVE to be wrapped in round brackets from start to end. All equivalence tests require TWO equals signs. Also, you will notice that there are some other symbols, the two ampersand signs means you want to combine the left and right results in an AND test, whereas the two pipes means that you want to do an OR operation.
Okay the final bit are the parenthesis - this marks the start and end of a block, so if the condition is true, the code will run whatever is in that code block
And now to PureBasic.
Just read it.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Foz »

Primoz128 wrote:i can make my code of for example 500 lines of code so good for me that in just a minute i understand it completely, while if you gave me BASIC one of such length i would definetly need hours to be able to understand it just partly
It sounds like you need to stick to C/C++ then.
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

Foz wrote:Let's take a simple example:

Code: Select all

int a = 1;
int b = 1;
int c = 3;
If((a == 1 && b == 2) || c == 3) {
  // code
}
vs

Code: Select all

a = 1
b = 1
c = 3
If (a = 1 And b = 2) Or c = 3
  ; code
EndIf
Now, you have to explain the code to someone from the ground.
Let us start with C:
Okay, first we have to declare our variables, and we are also assigning the values to them, so a equals 1, b equals 1, etc. Note that the semi colon is required to mark the line as then end of a coding line - every line unless it ends with a parenthesis or a comment.
Then we have a decision branch - the If statement. Now all decisions HAVE to be wrapped in round brackets from start to end. All equivalence tests require TWO equals signs. Also, you will notice that there are some other symbols, the two ampersand signs means you want to combine the left and right results in an AND test, whereas the two pipes means that you want to do an OR operation.
Okay the final bit are the parenthesis - this marks the start and end of a block, so if the condition is true, the code will run whatever is in that code block
And now to PureBasic.
Just read it.
For this yes, but when doing lots of ifs with endifs that ends up a huge mess compared to c++.
Thorium
Addict
Addict
Posts: 1314
Joined: Sat Aug 15, 2009 6:59 pm

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Thorium »

I also like the readability of BASIC.
Every coder can read BASIC code, no matter what language he is used to. Reading C/C++ code is much harder.

Especialy with the ugly brackets all over the place. And i dont get whats the matter with the semicolon. Both dont make the language bad but if it comes to readability BASIC is just superior.
Foz
Addict
Addict
Posts: 1359
Joined: Tue Nov 13, 2007 12:42 pm
Location: Manchester, UK

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Foz »

*snort* if you say so - I got completely lost with the brackets and had to use an IDE to work it out.

Code: Select all

if (a = 1) {
  if (b = 1) {
    if (c = 3) {
      // code
    }
    else {
      // code
    }
  }
  else {
    // code
  }
}
else {
  // code
}
Whereas this was easy:

Code: Select all

If a = 1
  If b = 1
    If c = 3
      ; code
    Else
      ; code
    EndIf
  Else
    ; code
  EndIf
Else
  ; code
EndIf
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

Foz wrote:*snort* if you say so - I got completely lost with the brackets and had to use an IDE to work it out.

Code: Select all

if (a = 1) {
  if (b = 1) {
    if (c = 3) {
      // code
    }
    else {
      // code
    }
  }
  else {
    // code
  }
}
else {
  // code
}
Whereas this was easy:

Code: Select all

If a = 1
  If b = 1
    If c = 3
      ; code
    Else
      ; code
    EndIf
  Else
    ; code
  EndIf
Else
  ; code
EndIf

My style of formating code:

Code: Select all

if (a = 1) 
   {
      if (b = 1) 
         {
            if (c = 3) 
               {
                  // code
               }
           else 
              {
                  // code
              }
         }
      else 
         {
            // code
         }
   }
else 
   {
      // code
   }
User avatar
STARGÅTE
Addict
Addict
Posts: 2315
Joined: Thu Jan 10, 2008 1:30 pm
Location: Germany, Glienicke
Contact:

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by STARGÅTE »

Image

sry, I think it looks more chaotic than in Basic!

EDIT:
In Basic, I can see below what keyword is up,
I see in C++ only } } }

Code: Select all

Repeat
	For N = 1 To 10
		If A = 1
			Select B
				Case 2
					; ...
			EndSelect
		EndIf
	Next
ForEver
PB 6.01 ― Win 10, 21H2 ― Ryzen 9 3900X, 32 GB ― NVIDIA GeForce RTX 3080 ― Vivaldi 6.0 ― www.unionbytes.de
Lizard - Script language for symbolic calculations and moreTypeface - Sprite-based font include/module
User avatar
Primoz128
Enthusiast
Enthusiast
Posts: 212
Joined: Sat Sep 10, 2011 8:25 pm
Location: Slovenia

Re: Who here likes the BASIC syntax and why ? If notTHENwhic

Post by Primoz128 »

STARGÅTE wrote:Image

sry, I think it looks more chaotic than in Basic!

EDIT:
In Basic, I can see below what keyword is up,
I see in C++ only } } }

Code: Select all

Repeat
	For N = 1 To 10
		If A = 1
			Select B
				Case 2
					; ...
			EndSelect
		EndIf
	Next
ForEver
You don't seem to look at my way at all.
Post Reply