This short code snippet does not work as expected...???

This short code snippet does not work as expected...???

Postby RBSe » Thu Jul 18, 2013 9:19 am

Greetings All,

The following code does not work.
From my screen:

===
Control BASIC v0.73
R-Run S-Step L-List E-Edit C-Configure B-Bank D-Download K-Reset T-Time & Date

Program Listing:
' create random passcode to enter and speak...
RNDpassword$ = ""
RNDpass$=STR$(INT(RND(9000)+1000)) ' random number between 1000 & 9999
? RNDpass$
FOR cnt = 1 TO 4
Z$ = MID$(RNDpass$,cnt,1)
RNDpassword$ = RNDpasswword$ + " " + Z$ '<<<<==== ERROR HERE ====####
NEXT cnt
? RNDpassword$

' It should result this example: RNDpass$ = "4094" = RNDpassword$ = " 4 0 9 4"

End of Listing


Control BASIC v0.73
R-Run S-Step L-List E-Edit C-Configure B-Bank D-Download K-Reset T-Time & Date
Start program
6289
No such variable line # 7

Program Ended.


Control BASIC v0.73
R-Run S-Step L-List E-Edit C-Configure B-Bank D-Download K-Reset T-Time & Date
===


What am i doing wrong, if anything...???

Thanks for your help...

Robert
.

Code: Select all
' create random passcode to enter and speak...
                RNDpassword$ = ""
                RNDpass$=STR$(INT(RND(9000)+1000)) ' random number between 1000 & 9999
                ? RNDpass$
                FOR cnt = 1 TO 4
                        Z$ = MID$(RNDpass$,cnt,1)
                        RNDpassword$ = RNDpasswword$ + " " + Z$ '<<<<==== ERROR HERE ====####
                NEXT cnt
                ? RNDpassword$

' It should result this example: RNDpass$ = "4094" = RNDpassword$ = " 4 0 9 4"
Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom.

Clifford Stoll
User avatar
RBSe
 
Posts: 33
Joined: Wed Mar 06, 2013 7:42 pm
Location: Eureka, California

Re: This short code snippet does not work as expected...???

Postby Andries Pretorius » Thu Jul 18, 2013 11:23 am

The second variable "RNDpasswword$" in LIne 7 is spelt differently from the first "RNDpassword$" Robert. There is an extra w .

If you use the same spelling for both it works.

Best regards
ANDRIES
Andries Pretorius
 
Posts: 37
Joined: Thu Nov 01, 2012 10:57 am
Location: Johannesburg, South Africa

Re: This short code snippet does not work as expected...???

Postby RBSe » Thu Jul 18, 2013 7:16 pm

WoW...

I did not even see that at all. :oops:
i thought it made sense but i couldn't figure it out.
Sometimes i miss the obvious when i'm looking for the obscure...
Thanks again Andries

Robert
.
Data is not information, information is not knowledge, knowledge is not understanding, understanding is not wisdom.

Clifford Stoll
User avatar
RBSe
 
Posts: 33
Joined: Wed Mar 06, 2013 7:42 pm
Location: Eureka, California


Return to EzSBC1

Who is online

Users browsing this forum: No registered users and 1 guest

cron