Page 40 - RoboGenius Pro C6
P. 40

Variables

                  Variable blocks are like boxes that store information you can use later in your code. You can put
                  a number, word or value inside and change it whenever you want. Some of the important variable
                  blocks are as follows:
                               Blocks                                          Description

                                                     This block is used to create a new variable.
                        Create number variable...

                                                     This block represents a variable, which is like a container that
                     i
                                                     stores a number. In loops, it keeps track of the current count.

                                                     This block assigns a value to the variable.
                    Set  i  to 0

                                                     This block  is  used  to  increase  or decrease  the  value  of a
                    Change i   by 1
                                                     variable by a certain number.

                  Templates

                  The Templates category is used to save, reuse and organise blocks of code that you have already
                  created. Templates make coding easier instead of rebuilding the same set of blocks again and
                  again, you can store them once and use them whenever you need.

                  To create a new template, click on      Create Template   block.

                  Mark Up

                  The Mark Up category is used to add notes organise and label your code. These blocks don’t
                  change your 3D design, but they make your project easier to understand, especially when your
                  code gets long or when you’re sharing it with others. The Mark Up blocks used in Tinkercad are
                  given below:

                         Blocks                                         Description

                                        This block  is used  to  write  notes  inside  your  code.  Helps you  or others
                    //  Comments
                                        understand what the next blocks are doing.

                                        This block is used to display a message while your code runs. It helps you
                    Say Message
                                        show information, like the value of a variable or what the program is doing.


                  BUILD A TOWER USING REPEAT BLOCK

                  To build a tower in Codeblocks, follow the given steps:

                    STEP - 1   Click on the Create number variable button from the Variables block, type height
                               in textbox and click on the OK button.

                   STEP - 2    Add the Add Box block from the Shapes blocks category to make the base of the
                               tower and customise it with a width of 30, length of 30, height of 10 and Edge Steps
                               to 10.


                                 RoboGenius Pro - VI
                 38
   35   36   37   38   39   40   41   42   43   44   45