Discuss Scratch
- Discussion Forums
- » Suggestions
- » Delete Whatever In Lists
- JohnAppleTree
-
New Scratcher
2 posts
Delete Whatever In Lists
Basically, the ability to delete whatever you want, instead of being forced to delete by number only. Realistically this shouldn't require a new block, as Add to List can do the same thing. I know this isn't really how lists work in coding languages, but I figured it would be nice for QOL.
- FreshTheCat
-
Scratcher
500+ posts
Delete Whatever In Lists
Are you looking for
delete all of [list v] //well, deletes all of a listor
delete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that numberor something else?
- medians
-
Scratcher
1000+ posts
Delete Whatever In Lists
Are you looking forI thought it was like this:delete all of [list v] //well, deletes all of a listordelete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that numberor something else?
delete (1)th instance of [thing] in [list v]::listIn that case, we could have:
delete last instance of [thing] in [list v]::list
delete all instances of [thing] in [list v]::list
([1]th instance of [thing] in [list v]::list)For the delete all instances, you could do this:
(number of [thing] in [list v]::list)
repeat until <not <[list v] contains [thing]?>>
delete ([1]th instance of [thing] in [list v]::list) of [list v]
end
- JohnAppleTree
-
New Scratcher
2 posts
Delete Whatever In Lists
What I meant was giving the “Delete # of List” the ability o put whatever you want in it instead of numbers, like you can with “Add __ to List”, instead of being limited to just putting in numbers. That way you wouldn't need to use the lower block combination. Thats a good workaround though, I didn't think about that, thank you.
Are you looking fordelete all of [list v] //well, deletes all of a listordelete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that numberor something else?
- Discussion Forums
- » Suggestions
-
» Delete Whatever In Lists