The contents of the box may be entered as a variable and manipulated by functions such as LABEL. Eg to writename make RL “TheirName label :TheirName end READCHAR Readchar performs a similar input function to readlist but only the first character (ie the is read “char”) into the variable. If the user enters a word (or sentence) only the first letter will be entered into the variable. Converting Input to a Number The function will extract the first item in a list. In the case of numerals it will convert the “FIRST” numeral to a number. NOTE: If you don’t use the numeral will be a character and you will not “first”, be able to carry out mathematical operations on it. Eg. to GetFirstNumber ; A sample routine to demonstrate “readchar” ; and to extract a number from user input. “first” ; based on suggestions made by Paul Dench make readchar “Number1 make :Number1 * 10 “Answer home cs ht label :Answer end Writing Procedures in MSW Logo Good programming technique dictates that tasks should be broken down into small 'modules' where each module performs one small, simple task. This approach is called "Top-down Design". In MSW Logo this is achieved using structures called "Procedures". If, for example, you wanted to draw a frame around each screen you use you could include the following lines each time you constructed the frame: LT 90 PU FD 200 RT 90 PD
The contents of the box may be entered as a variable and manipulated by functions such as LABEL. Eg to writename make “TheirName RL label :TheirName end READCHAR Readchar performs a similar input function to readlist but only the first character (ie the “char”) is read into the variable. If the user enters a word (or sentence) only the first letter will be entered into the variable. Converting Input to a Number The function “FIRST” will extract the first item in a list. In the case of numerals it will convert the numeral to a number. NOTE: If you don’t use “first”, the numeral will be a character and you will not be able to carry out mathematical operations on it. Eg. to GetFirstNumber ; A sample routine to demonstrate “readchar” ; and “first” to extract a number from user input. ; based on suggestions made by Paul Dench make “Number1 readchar make “Answer :Number1 * 10 home cs ht label :Answer end Writing Procedures in MSW Logo Good programming technique dictates that tasks should be broken down into small 'modules' where each module performs one small, simple task. This approach is called "Top-down Design". In MSW Logo this is achieved using structures called "Procedures". If, for example, you wanted to draw a frame around each screen you use you could include the following lines each time you constructed the frame: LT 90 PU FD 200 RT 90 PD