[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions_content.php on line 1014: Undefined array key 3
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4130: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3009)
Controlling your World the Easy Way • This short code snippet does not work as expected...???
Page 1 of 1

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

Posted: Thu Jul 18, 2013 9:19 am
by RBSe
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"

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

Posted: Thu Jul 18, 2013 11:23 am
by Andries Pretorius
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

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

Posted: Thu Jul 18, 2013 7:16 pm
by RBSe
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
.