Level 1, lesson 7

# 1.7 Printing a string variable

Printing a string variable is pretty straight forward. The word that is required to print a string variable is 'TYPE'. It requires the string address and the number of characters it has to print. Yes, that are the values that are left on the stack by 'COUNT'! So printing a string means issuing both 'COUNT' and 'TYPE':

         32 string greeting              \ define string greeting
         " Hello!" greeting copy         \ set string to 'Hello!'
         count type cr                   \ print the string

If you don't like this you can always define a word like 'PRINT$':

         : print$ count type ;
         32 string greeting              \ define string greeting
         " Hello!" greeting copy         \ set string to 'Hello!'
         print$ cr                       \ print the string