Whenever they are used in these sheets, ignore them! Don't type them in! NOTE: The "" symbols contain instructions. (See page 4 if your are not sure where the Input Box is.) based on suggestions made by Paul Dench make “Number1 readcharĢ. A sample routine to demonstrate “readchar” 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. In the case of numerals it will convert the numeral to a number. The function “FIRST” will extract the first item in a list. If the user enters a word (or sentence) only the first letter will be entered into the variable. Readchar performs a similar input function to readlist but only the first character (ie the “char”) is read into the variable. The contents of the input box may be entered as a variable and manipulated by functions such as LABEL. The function “readlist” displays the dialogue box (as below) and allows the user to enter text. See the next page for an explanation of READLIST. Based on suggestions made by Paul Dench make “Number1 first readlist A sample routine to demonstrate “readlist” The word “first” before “questionbox” is a MSW Logo function that extracts the first value entered by the user as a number. NOTE: The variable names can be just about anything. Make “Number1 first questionbox make “Number2 first questionbox make “Answer :Number1 * :Number2 and “first” to extract a number from user input. A sample routine to demonstrate “questionbox” There is no equivalent to Pascal’s “readln(variable)”
If you want to write a programme which accepts user input and then acts on it you must use the standard Windows GUI for user input. It makes extensive use of the built-in Windows “Graphical Users Interface (“GUI”).
MSW Logo is a Windows programming language. MSW Logo - A Simplified Reference (Version 2) © 1998 J.
NOTE: If you type in box, without the value, MSW Logo will report an error. The size of the box can be determined by the value typed in when running the procedure. When accessing a variable’s value you must put a colon in front of the variable name. IMPORTANT – You need to understand the difference between using a variable and ordinary text. Make “Answer :Number1 * :Number2 label :Answer The value of the variable is accessed in the form: label :MyVariable (NOTE: the colon in front of the variable name.) MSW Logo uses a statement in the form: make “MyVariable 20 to assign a value to a variable. You can change the value of a variable at any time. This single command would have the same effect as the eight individual commands above - it draws a square.A variable can be thought of as a ‘container’ for different values. The same commands can be written more quickly using the REPEAT command, for example: These commands can be used to draw a square on the screen: Here are some examples of the most common Logo commands: Command
There are many commands which can be used to control the turtle. Logo is often used with a screen turtle, which is an object on the screen used to simulate how a turtle moves around the floor. For example, a small robot known as a turtle can be moved around the floor using logo. Logo is a simple computer programming language which can be used to control devices.