WB4WTN
Posts: 27
Joined: Thu Jan 17, 2013 9:27 pm

Sleep In BBC Basic?

Wed Jun 23, 2021 8:49 pm

I am playing around with BBC Basic and it appears there is no SLEEP keyword. What (if any) is the best way to have a program sleep? Thanks.

klricks
Posts: 7853
Joined: Sat Jan 12, 2013 3:01 am
Location: Grants Pass, OR, USA
Contact: Website

Re: Sleep In BBC Basic?

Wed Jun 23, 2021 9:14 pm

WB4WTN wrote:
Wed Jun 23, 2021 8:49 pm
I am playing around with BBC Basic and it appears there is no SLEEP keyword. What (if any) is the best way to have a program sleep? Thanks.
Look at WAIT command.
Unless specified otherwise my response is based on the latest and fully updated RPiOS Buster w/ Desktop OS.

WB4WTN
Posts: 27
Joined: Thu Jan 17, 2013 9:27 pm

Re: Sleep In BBC Basic?

Wed Jun 23, 2021 10:07 pm

klricks wrote:
Wed Jun 23, 2021 9:14 pm
WB4WTN wrote:
Wed Jun 23, 2021 8:49 pm
I am playing around with BBC Basic and it appears there is no SLEEP keyword. What (if any) is the best way to have a program sleep? Thanks.
Look at WAIT command.
Thanks for the reply. I had looked at the keywords on the BBC Basic page and did not see WAIT. But it does work.

User avatar
scruss
Posts: 4185
Joined: Sat Jun 09, 2012 12:25 pm
Location: Toronto, ON
Contact: Website

Re: Sleep In BBC Basic?

Thu Jun 24, 2021 12:36 am

WAIT
A statement causing the program to pause for the specified number of centiseconds (hundredths of a second).

WAIT 100

This causes the program to pause for approximately one second.

WAIT 0 results in only a short pause (typically about 1 millisecond), but does give other programs an opportunity to run; it can be useful in preventing your program consuming 100% of the processor's time.

WAIT without a parameter does nothing; it is provided for compatibility with Acorn's BASIC 5 (in which it waits for the next vertical-retrace event).
Syntax

WAIT [<numeric>]
https://www.bbcbasic.co.uk/bbcwin/manual/bbcwin7.html#wait
‘Remember the Golden Rule of Selling: “Do not resort to violence.”’ — McGlashan.
Pronouns: he/him

User avatar
RichardRussell
Posts: 765
Joined: Thu Jun 21, 2012 10:48 am

Re: Sleep In BBC Basic?

Thu Jun 24, 2021 10:56 am

WB4WTN wrote:
Wed Jun 23, 2021 10:07 pm
I had looked at the keywords on the BBC Basic page and did not see WAIT.
You were possibly looking at the 'generic' BBC BASIC landing page, which doesn't include WAIT in its list of keywords, but it's in the more detailed manual pages for BBC BASIC for Windows and BBC BASIC for SDL 2.0.

Return to “Other programming languages”