Hello,
I am trying to get a better understanding of arrays, and have written the code below. I "think"
it should output the letters "A" through "j" ;however, it outputs A - K. Anyone know why?
Code:@ __config _HS_OSC & _WDT_OFF & _PWRTE_ON & _LVP_OFF & _BODEN_OFF define OSC 20 include "modedefs.bas" LETTERS VAR BYTE String var byte[10] serout PortB.6,T9600,[254,128,"Loop Check"] pause 500 serout PortB.6,T9600,[$FE,1] string[0]= "A" string[1]= "B" string[2]= "C" string[3]= "D" STRING[4]= "E" STRING[5]= "F" STRING[6]= "G" STRING[7]= "H" STRING[8]= "I" STRING[9]= "J" loop: FOR letters = STRING[0] to STRING[9] serout PortB.6,T9600,[254,128,"string is ",(LETTERS)] pause 500 NEXT letters goto loop



Unless a simple FOR To Next without array would have worked.



Bookmarks