Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • CreatiCode
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

CreatiCode Scratch Forum

  1. CreatiCode Forum
  2. Knowledge Base
  3. 2D Blocks
  4. Introduction to Lists

Introduction to Lists

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 1.4k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • CreatiCodeI Offline
    CreatiCodeI Offline
    CreatiCode
    wrote on last edited by admin
    #1

    Prerequisite

    • Introduction to Variables

    What is a List?

    You already know how to use a variable as a box to store some number or text. When you work with a sequence of values, such as the ages of all your classmates, then you should use a “list” instead.

    A list is an array of boxes, where each box has a different position number (indices).

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/9e8332e2-e50e-4d50-96dc-a7a92f954655.gif" width="500" style="">

    Since all the boxes look the same, we need to use the position index number to refer to a box. For example, you can say “The box at position 2 contains the number 8”.

     

    Making a New List

    To create a new list, go to the “Variables” category, and click the “Make a list” button.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/33543cef-17ce-4537-a51e-20dca8b7b5c3.gif" width="885" style="">

     

    Renaming or Deleting a List

    These steps are very similar to how you rename or delete a variable.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/97ad1930-aa85-4b7d-9e88-91a5e43aca14.gif" width="997" style="">

     

    Showing or Hiding a List

     
    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/81d04966-519f-4069-969a-918fa148e827.gif" width="997" style="">

     

    Adding Empty Items to a List

    By default, a new list has no items (slots) in it. You can click the “+” button on its bottom left corner to add empty items. The “length” value will tell us how many items are in the list, which is how many values this list can carry.

     
    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/7fea7078-bbd3-4688-bd46-f78f440d9742.gif" width="157" style="">

     

    Removing an Item

    When any item is selected, there is a small “x” on its right, which can be used to remove this item.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/87c0366a-bcda-4a4e-806b-b38ff22de207.gif" width="152" style="">

     

    Adding Data

    You can input numbers or text in any item of the list. If you press the ENTER key, a new empty item will be added below the current one, which makes it easier to enter many values.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/07abd72b-b20b-473f-b636-660e72fdbff1.gif" width="324" style="">

    Note that when you save the project, the content of the list is saved as well. So the next time you open this project, the list will contain the same content.

     

    Learn More

    • Editing a List Using Blocks
    1 Reply Last reply
    0
    • CreatiCodeI CreatiCode pinned this topic on

    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

    With your input, this post could be even better 💗

    Register Login
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • CreatiCode