BBC BASIC for Windows
« A quick question-variables »

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



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: A quick question-variables  (Read 410 times)
Bailey
New Member
Image


member is offline

Avatar




PM


Posts: 3
xx A quick question-variables
« Thread started on: Dec 17th, 2012, 3:32pm »

How do i add a word as a variable?
I thought it was like this....
name$=james
PRINT"welcome";name

what am I doing wrong?

Thanks James
« Last Edit: Dec 17th, 2012, 3:33pm by Bailey » User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: A quick question-variables
« Reply #1 on: Dec 17th, 2012, 3:41pm »

on Dec 17th, 2012, 3:32pm, Bailey wrote:
name$=james
PRINT"welcome";name

Did you mean this:

Code:
name$="James"
PRINT "Welcome ";name$ 

Richard.
User IP Logged

Bailey
New Member
Image


member is offline

Avatar




PM


Posts: 3
xx Re: A quick question-variables
« Reply #2 on: Dec 17th, 2012, 3:55pm »

Yes I did and thank you soo much :)

If i was a name style password thing
so you type the correct name and get to continue what do i do Something like this ?
Code:
name$="james"
PRINT "Welcome user what is your name?"
INPUT A
IF A=james 
GOTO
7
ELSE
END 
7
PRINT "CONTINUE" 


Thanks for the quick reply with my last post Just trying to get the hang of BBC :) !
User IP Logged

admin
Administrator
ImageImageImageImageImage


member is offline

Avatar




PM


Posts: 1145
xx Re: A quick question-variables
« Reply #3 on: Dec 17th, 2012, 4:43pm »

on Dec 17th, 2012, 3:55pm, Bailey wrote:
INPUT A
IF A=james

Unlike some other BASICs, BBC BASIC requires string variables always to end with a $, so:

Code:
INPUT A$
IF A$="james" THEN 

or

Code:
INPUT A$
IF A$=name$ THEN 

I would suggest that you spend some time working through the Beginners' Tutorial before you pick up too many bad habits (like using GOTO!):

http://www.bbcbasic.co.uk/bbcwin/tutorial/

Richard.
User IP Logged

Bailey
New Member
Image


member is offline

Avatar




PM


Posts: 3
xx Re: A quick question-variables
« Reply #4 on: Dec 17th, 2012, 5:25pm »

Lol will do smiley Thanks
Was on the guide when I got confused with the Variable and didnt want to keep going untill i understood all aspects just thought i would kill two birds with one stone ! smiley Thanks Again you have been a real help smiley ! No wonder my school has BCC !!
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