BBC BASIC for Windows
« RND(X%) »

Welcome Guest. Please Login or Register.
Apr 5th, 2018, 10:10pm



ATTENTION MEMBERS: Conforums will be closing it doors and discontinuing its service on April 15, 2018.
Ad-Free has been deactivated. Outstanding Ad-Free credits will be reimbursed to respective payment methods.

If you require a dump of the post on your message board, please come to the support board and request it.


Thank you Conforums members.

BBC BASIC for Windows Resources
Online BBC BASIC for Windows documentation
BBC BASIC for Windows Beginners' Tutorial
BBC BASIC Home Page
BBC BASIC on Rosetta Code
BBC BASIC discussion group
BBC BASIC for Windows Programmers' Reference

« Previous Topic | Next Topic »
Pages: 1  Notify Send Topic Print
 thread  Author  Topic: RND(X%)  (Read 438 times)
TalkBASICToMe
New Member
Image


member is offline

Avatar




PM

Gender: Female
Posts: 1
xx RND(X%)
« Thread started on: Oct 14th, 2015, 2:55pm »

I was going through the tutorials, when it said this:

"RND(X%) where X% is a positive integer value greater than 1. This will return a random number in the range 1 up to and including X%"

I tried that with some positive integer values of X and got the "missing bracket" error message. Obviously, I checked to see if there was a missing bracket and there wasn't.

Please advise.
User IP Logged

sbracken
New Member
Image


member is offline

Avatar




PM


Posts: 19
xx Re: RND(X%)
« Reply #1 on: Oct 14th, 2015, 3:50pm »

After playing around, I think your problem must be that you are doing this:

Code:
PRINT RND(3%) 


rather than this:

Code:
PRINT RND(3) 


X% is an example of an integer variable, so the % should not be included in the RND statement unless it is part of a variable name:

Code:
X%=3
PRINT RND(X%) 


More info on variable types can be found here:

http://bbcbasic.co.uk/bbcwin/manual/bbcwin2.html#types

If this is not the problem, please post an example of the sort of code that throws the error.

Simon

« Last Edit: Oct 16th, 2015, 08:10am by sbracken » User IP Logged

Pages: 1  Notify Send Topic Print
« Previous Topic | Next Topic »

| |

This forum powered for FREE by Conforums ©
Terms of Service | Privacy Policy | Conforums Support | Parental Controls