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. Editing a List Using Blocks

Editing a List Using Blocks

Scheduled Pinned Locked Moved 2D Blocks
1 Posts 1 Posters 1.1k 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 Online
    CreatiCodeI Online
    CreatiCode
    wrote on last edited by admin
    #1

    Prerequisite

    • Introduction to Lists

     

    Description

    You can easily edit a list using blocks, such as adding new items, removing some items, or changing the value of some items.

     

    Appending a New Item

    This block can be used to add a new item at the bottom of the list. The length of the list will increase by 1 each time we run this block.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ce650e0b-bc12-4b2b-b94a-7258cecf7265.png" width="300" style="">

     

    Parameters

    • Value: the number or text to be added. If you leave this field empty, an empty item will be added to the list.
    • List Name: select the name of the list. You need to create that list before you can choose it in this dropdown.

     

    Demo

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/b06717d5-67b2-4737-904b-61e6f6d387da.gif" width="970" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Inserting a New Item

    If you want the new item to be placed at a particular position (not at the bottom), you can use the insert block.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1ad6b84f-b63c-4710-a810-d33ab571e2d7.png" width="420" style="">

     

    Parameters

    • value: the number or text to be added. If you leave this field empty, an empty item will be inserted to the list.
    • Position Index: the position of the new item. For example, if the list already has 2 items, then the position index parameter can only be 1, 2 or 3.
    • List Name: the name of the list. You need to add at least one list manually first.

     

    Demo

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ad9dcbae-adbe-45bc-99db-458e4cec8384.gif" width="970" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Replacing an Item

    You can change the value of an item in the list if you know its position index.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/ad58abcd-5a8c-456d-833c-8de76bed7f94.png" width="500" style="">

     

    Parameters

    • Position Index: the position of the item to be changed. For example, if the list already has 3 items, then the position index parameter can only be 1, 2 or 3.
    • List Name: the name of the list.
    • Value: the new value for that item, and it can be empty as well.

     

    Demo

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/a70c1020-af1e-4381-a4f2-eeeaebe175a2.gif" width="970" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Deleting an Item by Its Position Index

    You can remove an item from the list with this block if you know its position.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/6262d4f7-835d-4100-88a9-f9342eda07ae.png" width="300" style="">

     

    Parameters

    • Position Index: the position of the item to be deleted. For example, if the list already has 3 items, then the position index parameter can only be 1, 2 or 3.
    • List Name: the name of the list.

     

    Demo

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/bde86b51-6d06-4930-9f44-ba023f653ea0.gif" width="970" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Deleting an Item by Its Value

    This block allows you to delete an item by its value. This is handy when you do not know the position of the item to be deleted, but you know its value.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/3c93a241-447f-4f12-89d4-c70e7cefcd8a.png" width="380" style="">

     

    Parameters

    • Value: The value of the item to be deleted. If that value can not be found in the list, then no item will be deleted. When more than one item has this value, only the first item with this value will be deleted.
    • List Name: The name of the list.

     

    Demo

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/1504d62f-439e-41df-8c57-d0cd753cea81.gif" width="970" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Deleting All Items

    This block will delete all items in a list and make the list empty.

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/668aab94-fda9-4a8e-bba4-3fb10af6673a.png" width="270" style="">

     

    Changing the Value of an Item

    These 2 blocks allow us to increase or decrease an item’s value by some number:

    https://cdncreaticodecom.b-cdn.net/scratch-gui-projects/forum/f5bd838d-aa96-4cb6-9489-5089a1d4ab41.gif" width="570" style="border-radius: 5px; border: 1px solid #29622d;">

     

    Learn More

    • Reading from a List
    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