Discuss Scratch

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 list
or
delete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that number
or something else?
medians
Scratcher
1000+ posts

Delete Whatever In Lists

FreshTheCat wrote:

Are you looking for
delete all of [list v] //well, deletes all of a list
or
delete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that number
or something else?
I thought it was like this:
delete (1)th instance of [thing] in [list v]::list

delete last instance of [thing] in [list v]::list

delete all instances of [thing] in [list v]::list
In that case, we could have:

([1]th instance of [thing] in [list v]::list)

(number of [thing] in [list v]::list)
For the delete all instances, you could do this:
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.

FreshTheCat wrote:

Are you looking for
delete all of [list v] //well, deletes all of a list
or
delete (item # of [] in [list v]) of [list v] //finds the number of an item, then deletes the item at that number
or something else?

Powered by DjangoBB