While the 'uppercase function would do you nicely, I presume you're primarily looking for a better understanding of why your scripts aren't doing what you expect. I would definitely suggest you insert some "debug print" statements, as is normal in all debugging efforts.. and SEE what's actually happening for yourself. You'll learn a lot more that way. Perhaps the following will give you some ideas of how to succeed at the approach you were attempting: REBOL[] foreach ch string: ask "Please enter a string to upcased: " [ if (ch >= to-char "a") and (ch <= to-char "z") [ change string ch - 32 ] string: next string ] print head string There were two difficulties in your script: 1. The index of 'string was never changing in your 'foreach loop, so it kept 'changing the head item each time through. Adding the line (string: next string) advances the index on each pass. 2. The offset between upper and lower case characters is 32, not 26 as you presumed. That's why "a" was becoming "G". Check an ASCII character chart. Russ ------------------------------------- At 09:50 PM 10/12/99 -0700, you wrote: >Could someone please provide some input as to why my script does not convert >all lowercase letters to uppercase? It seems to stop after the first >conversion (which incidentally is to the wrong letter). > >>> do %upcase-string.r >do %upcase-string.r >Script: "Upcase string" (11-Oct-1999) >Please enter a string to upcased: aaaAAA >aaaAAA >== #"A" >>> string >string >== "GaaAAA" >>> > > >REBOL [ snip] > >string: ask "Please enter a string to upcased: " >posctr: 0 >upcase-string: foreach character string [ > posctr: posctr + 1 > either character > 91 > [ change string character - 26 ] > [ character ] >] > >
