LET me ask a stupid quieston

on-topic acorn-related discussions not covered by the other forums
Post Reply
avtovaz
Posts: 81
Joined: Wed Jan 18, 2017 5:09 pm
Contact:

LET me ask a stupid quieston

Post by avtovaz » Sat Oct 17, 2020 10:56 pm

i dont understand this, what is the difference between these two statements


LET A=A+2

A=A+2

stupid question probably but i dont understand

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Sat Oct 17, 2020 11:05 pm

No difference at all.

LET is optional, but some people like it because otherwise L = L+1 looks like an incorrect statement. No it isn't!!

avtovaz
Posts: 81
Joined: Wed Jan 18, 2017 5:09 pm
Contact:

Re: LET me ask a stupid quieston

Post by avtovaz » Sat Oct 17, 2020 11:09 pm

thought so... i was reading a book 30 hour basic and it was saying something i just didnt understand.


thankyou!

User avatar
1024MAK
Posts: 10294
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: LET me ask a stupid quieston

Post by 1024MAK » Sat Oct 17, 2020 11:20 pm

LET is optional in some versions of BASIC, but required in some other versions. In the versions where LET is required, if it’s not present, you will get an error (often a syntax error).

With BBC BASIC, LET is optional, so most programmers leave it out. But in listings designed for use on a wide variety of machines, LET will be used.

Mark

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Sun Oct 18, 2020 12:06 am

It is also optional in Microsoft BASIC which accounts for most of the other 80s micros. In 70s minicomputer BASICs, LET was sometimes required.

I am just learning BCPL on the Beeb and that uses a LET keyword quite extensively, interestingly enough.

Marvin
Posts: 91
Joined: Fri Mar 06, 2020 11:27 am
Contact:

Re: LET me ask a stupid quieston

Post by Marvin » Sun Oct 18, 2020 12:07 am

And just for completeness, on later versions of BASIC as shipped with the 32bit machines rather than writing...

A=A+2

You could do...

A+=2

User avatar
Lardo Boffin
Posts: 2174
Joined: Thu Aug 06, 2015 7:47 am
Contact:

Re: LET me ask a stupid quieston

Post by Lardo Boffin » Sun Oct 18, 2020 6:56 am

Bobbi wrote:
Sun Oct 18, 2020 12:06 am
It is also optional in Microsoft BASIC which accounts for most of the other 80s micros. In 70s minicomputer BASICs, LET was sometimes required.

I am just learning BCPL on the Beeb and that uses a LET keyword quite extensively, interestingly enough.
Depending on how far you have got this may help: https://github.com/LardoBoffin/BBC-BCPL_Overview
Adventure Language on GitHub
Atom, issue 5
Elk
A number of econetted (is that a word?) Beebs
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA

User avatar
IanJeffray
Posts: 296
Joined: Sat Jun 06, 2020 3:50 pm
Contact:

Re: LET me ask a stupid quieston

Post by IanJeffray » Sun Oct 18, 2020 12:44 pm

And as a final wrinkle, note that LET cannot be used when assigning to pseudovariables such as TIME

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Sun Oct 18, 2020 5:05 pm

@Lardo Boffin -- thanks for the BCPL manuals and disks. I think I found some of that material already but not all of it.

User avatar
Lardo Boffin
Posts: 2174
Joined: Thu Aug 06, 2015 7:47 am
Contact:

Re: LET me ask a stupid quieston

Post by Lardo Boffin » Sun Oct 18, 2020 6:08 pm

Bobbi wrote:
Sun Oct 18, 2020 5:05 pm
@Lardo Boffin -- thanks for the BCPL manuals and disks. I think I found some of that material already but not all of it.
No worries. I live in hope of finding a copy of the calculations package at some point.
Adventure Language on GitHub
Atom, issue 5
Elk
A number of econetted (is that a word?) Beebs
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA

User avatar
Papalapa
Posts: 37
Joined: Sun Sep 27, 2020 5:49 pm
Contact:

Re: LET me ask a stupid quieston

Post by Papalapa » Wed Oct 21, 2020 7:40 am

As already explained by the colleagues, the statement is the same, but is a good idea to always put the "LET" command.

If do you migrate a BASIC program from one computer to another one maybe the "LET" command will be necessary for a particular BASIC version and also when do you debbug or check a whole program is easy to see the line starting by "LET".

User avatar
danielj
Posts: 8432
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: LET me ask a stupid quieston

Post by danielj » Wed Oct 21, 2020 8:35 am

Papalapa wrote:
Wed Oct 21, 2020 7:40 am
As already explained by the colleagues, the statement is the same, but is a good idea to always put the "LET" command.

If do you migrate a BASIC program from one computer to another one maybe the "LET" command will be necessary for a particular BASIC version and also when do you debbug or check a whole program is easy to see the line starting by "LET".
Hmm, can't say I'd agree. In BBC BASIC you have multi-statement lines, and using LET chews up precious memory needlessly. Certainly it's never something that's recommended in any of the programming guides for BBC BASIC. Personally speaking I find it a bit jarring to see LETs in BBC BASIC listings!

The only 8-bit BASIC I can think of that actually requires LET is Sinclair BASIC - and that's partially a necessity due to the single-key entry system. Sinclair BASIC is so distant to BBC BASIC that I can't really see the point in attempting to cater for it in a single listing. You don't even need LET in Applesoft BASIC!

If portability becomes the name of the game, then you have to start peppering your BBC BASIC listings with GOSUBs instead of PROCs and it starts to become horrendously messy :D

User avatar
1024MAK
Posts: 10294
Joined: Mon Apr 18, 2011 5:46 pm
Location: Looking forward to summer in Somerset, UK...
Contact:

Re: LET me ask a stupid quieston

Post by 1024MAK » Wed Oct 21, 2020 10:58 am

danielj wrote:
Wed Oct 21, 2020 8:35 am
The only 8-bit BASIC I can think of that actually requires LET is Sinclair BASIC
There is definitely more than one U.K. microcomputer where it’s BASIC requires the use of LET when assigning values to variables. And I don’t mean a ZX80, ZX81 or ZX Spectrum (or any of their ‘clones’ or compatibles).

So can anyone name at least one other U.K. microcomputer where this is the case?

Mark

User avatar
SimonSideburns
Posts: 564
Joined: Mon Aug 26, 2013 9:09 pm
Location: Purbrook, Hampshire
Contact:

Re: LET me ask a stupid quieston

Post by SimonSideburns » Wed Oct 21, 2020 12:35 pm

I had an Oric 1 back in the day, and I can't quite remember if LET was required or not, but I am going to say it was needed.
Just remember kids, Beeb spelled backwards is Beeb!

User avatar
danielj
Posts: 8432
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: LET me ask a stupid quieston

Post by danielj » Wed Oct 21, 2020 1:07 pm

SimonSideburns wrote:
Wed Oct 21, 2020 12:35 pm
I had an Oric 1 back in the day, and I can't quite remember if LET was required or not, but I am going to say it was needed.
Just checking the Oric manual, looks like it's not needed. I'm intrigued as to which it is!

d.

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Wed Oct 21, 2020 6:12 pm

Oric BASIC seems to be based on MS Extended BASIC, so LET would indeed be optional (think it is in all MS BASICs).

Just checked an LET is optional even on Tiny BASIC (which is the source of a few early non-MS BASICs).

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Wed Oct 21, 2020 6:15 pm

LET was required in Dartmouth BASIC first edition (according to Wikipedia) but it seems to be optional in some later versions even of the original Dartmouth BASIC.


User avatar
BigEd
Posts: 3450
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: LET me ask a stupid quieston

Post by BigEd » Wed Oct 21, 2020 7:24 pm

Me too! It's not Nascom, it's not Dragon, it's not Locomotive, ...

markdryan
Posts: 158
Joined: Sun Aug 20, 2017 11:37 pm
Contact:

Re: LET me ask a stupid quieston

Post by markdryan » Wed Oct 21, 2020 9:49 pm

Memotech perhaps? Just a guess as I've never used or even seen one of these in real life.

User avatar
BigEd
Posts: 3450
Joined: Sun Jan 24, 2010 10:24 am
Location: West
Contact:

Re: LET me ask a stupid quieston

Post by BigEd » Wed Oct 21, 2020 10:01 pm

Could be a winner! No hint of optionality of LET in the manual
http://www.primrosebank.net/computers/m ... Manual.pdf

User avatar
danielj
Posts: 8432
Joined: Thu Oct 02, 2008 5:51 pm
Location: Manchester
Contact:

Re: LET me ask a stupid quieston

Post by danielj » Wed Oct 21, 2020 10:18 pm

BigEd wrote:
Wed Oct 21, 2020 10:01 pm
Could be a winner! No hint of optionality of LET in the manual
http://www.primrosebank.net/computers/m ... Manual.pdf
And I know 1024MAK has a memotech... At least I think he does! :D

d.

Bobbi
Posts: 150
Joined: Thu Sep 24, 2020 12:32 am
Contact:

Re: LET me ask a stupid quieston

Post by Bobbi » Wed Oct 21, 2020 10:21 pm

Memotech! I believe you are correct!!

Coeus
Posts: 1821
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: LET me ask a stupid quieston

Post by Coeus » Thu Oct 22, 2020 4:31 pm

Bobbi wrote:
Sun Oct 18, 2020 12:06 am
I am just learning BCPL on the Beeb and that uses a LET keyword quite extensively, interestingly enough.
I think this comes from mathematics. One would say "Let a = ...." with some algebraic expression on the right hand side before using the 'a' just defined in the next expression below, i.e. how you build up something complex from smaller pieces.

Coeus
Posts: 1821
Joined: Mon Jul 25, 2016 12:05 pm
Contact:

Re: LET me ask a stupid quieston

Post by Coeus » Thu Oct 22, 2020 4:34 pm

Lardo Boffin wrote:
Sun Oct 18, 2020 6:08 pm
No worries. I live in hope of finding a copy of the calculations package at some point.
The disc is in your own archive. I have never seen the manual, though. One can guess a bit, as I did for a filing system tester but the manual would be really useful.

User avatar
Lardo Boffin
Posts: 2174
Joined: Thu Aug 06, 2015 7:47 am
Contact:

Re: LET me ask a stupid quieston

Post by Lardo Boffin » Thu Oct 22, 2020 4:59 pm

Coeus wrote:
Thu Oct 22, 2020 4:34 pm
Lardo Boffin wrote:
Sun Oct 18, 2020 6:08 pm
No worries. I live in hope of finding a copy of the calculations package at some point.
The disc is in your own archive. I have never seen the manual, though. One can guess a bit, as I did for a filing system tester but the manual would be really useful.
I have the disc image (but would like the original physical disc and box etc.) but yes it is really the manual that would be good to have scanned. :D
Adventure Language on GitHub
Atom, issue 5
Elk
A number of econetted (is that a word?) Beebs
BBC Master, Datacentre + HDD, pi co-proc, econet, NULA

Post Reply

Return to “general”