logsbrazerzkidai.blogg.se

How to write computer code repeating
How to write computer code repeating













how to write computer code repeating

To square :size repeat 4 end cs repeat 36 Ĭs make "size 200 repeat 36 Ĭs make "size 200 setpensize 2 repeat 36 Ĭs make "size 200 setpensize 2 setpencolor random 16 while :size > 0 Our own Procedures - We can write our own procedures in Logo, then use them like in-built functions! Create your own artistic creations using the power of Variables!ġ1. cs setpensize 2 make "angle 0 repeat 10 Ĭs setpensize 2 make "angle 0 repeat 45 Ĭs setpensize 2 make "angle 0 repeat 500 Ĭs pu setpensize 2 setxy -200 -100 repeat 4 Ĭs make "angle 0 repeat 25 Ĭs repeat 20 rt random 360 ]Ĭs make "size 250 setpensize 1 repeat 10 Ĭs make "size 10 repeat 50 Ĭs make "size 10 repeat 60 Ĭs rt 90 setpensize 2 setpencolor random 16 make "size 1 repeat 60 Ĭs setpensize 2 setpencolor random 16 make "turn 0 while :turn < 360 pu home pd make "turn :turn + 60 rt :turn ]Ĭs setpensize 2 make "turn 0 while :turn < 360 pu home pd lt :turn make "angle 0 while :angle < 180 pu home pd make "turn :turn + 120 rt :turn ]ġ0. Logo Variables print :variable can be used to print the values on screen. random function cs repeat 30 Ĭs setpensize 5 repeat 30 Ĭs repeat 10 ĩ. Let your creativity run wild and try a few colored picures of your own! 8. set pen size and fill color cs setpensize 50 arc 180 100 rt 180 arc 180 50Ĭs setpensize 20 arc 180 15 setpensize 50 arc 180 100 rt 180 arc 180 50Ĭs setpensize 20 setpencolor 4 arc 180 15 setpencolor 1 setpensize 50 arc 180 100 rt 180 setpencolor 2 arc 180 50Ĭs setpencolor 4 arc 360 100 fill setpencolor 1 arc 360 75 fill setpencolor 5 arc 360 50 fillĬS SETPENCOLOR 12 REPEAT 4 PU RT 45 FD 25 FILL BACK 100 PD LT 45 REPEAT 4 RT 45 FD 25 SETPENCOLOR 1 FILLħ. arc function to draw circle OR part of a circle.

how to write computer code repeating

Sets position of turtle to new values of X and YĬreates arc enclosed in angle 90 with radius 50Ĥ. Resets the turtle to centre of the screen Put the turtle pen back down on the paper.

how to write computer code repeating

Website stores your session history and saves your procedures to be re-used.īox in the bottom of the page looks like this:Ĭan issue the following commands and see them in action! Language to move a ‘turtle’ over the surface If you start working on code that was written by someone else, the style should be followed.A Program is a set of instructions to the computer to do a specific If you are using an IDE, it is recommended that you create a formatted config so everyone uses the same one.Įvery developer will be more comfortable with one style or another. In most of the programming languages, spaces and indentations do not affect the function. The code should be divided into logical units and it’s important to keep the style consistent throughout the whole document. Style is important, not to make code look pretty, but because it helps with reading, editing, and understanding. 11 Tips That Will Help You Write Better Code 1) Decide on the indentation and keep it that way

how to write computer code repeating

To write better code means mainly to understand it and keep it consistent. Being a programmer doesn’t mean to just write code that works, but it must be written cleverly and well so that your team or people that work with it afterward, can understand it easily.















How to write computer code repeating