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: 122
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: 10288
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: 122
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: 87
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: 2169
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: 275
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: 122
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: 2169
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

Post Reply

Return to “general”