Page 135 - CodePilot V5.0 C5
P. 135

5.   Lists Blocks: These blocks help you store and manage collections of items. You
                     can add, remove or find items in a list. Example:



                           create empty list   Creates an empty list with no element.




                           length of list  list  Returns the number of items in the list.




                 6.  Dictionaries Blocks: These blocks store data in key-value pairs. They help you
                     organise and access information using labels. Example:


                                              This block creates  a dictionary  without  any key-value
                       create empty dictionary
                                              pairs.



                         remove entry for key  This block removes the key-value mapping in the dictionary
                             from dictionary  for the given key.



                 7.  Colors Blocks: These blocks allow you to pick and use colours in your app. You
                     can set background colours or text colours using these. Example:


                                               This basic colour block is a small square block that shows
                                              a  specific  colour  in  the  middle,  representing  the  colour
                                              stored inside it.


                   make color  make a list  255  This block takes in a list of 3 or 4 numbers. These numbers
                                       0
                                       0      in this list represent values in an RGB code.



                 8.  Variables Blocks: These blocks store values that can change while the app runs.
                     You can create, set and get variable values. Example:


                                              This block allows you to access and use the current value
                                   get
                                              stored in a variable.


                                              This block assigns a new value to a variable. Like the get
                                 set   to
                                              block, only variables within scope appear in the drop-down.












                                                                                Creating Apps with MIT App Inventor  133
   130   131   132   133   134   135   136   137   138   139   140