Discuss Scratch

Programmer_55
Scratcher
51 posts

count instances Reporter

I think that it would be helpful to add a counting method for lists & strings. For lists, it would return the number of times that the given string appears in the list.
(count instances of[]in[list v]::list)
For strings, it would count the number of times that the first string appears within the second string.
(count instances of[]in[]::operators)
(“instances” should probably be replaced with a word that more people know, I was just using it because I can't think of anything better right now.)


Example:
(count instances of[aba]in[abbababa]::operators)
=2
(count instances of[3]in[Sample List 1 v]::list)
when Sample List 1 contains {1, 2, 4, 3, 0, 3, 23, 42}=2

Old account of Ninji2701. Go check that for more info.
BobzGames
Scratcher
70 posts

count instances Reporter

Support, could be very useful. Might be a dupe

If your seeing this, it means I forgot to switch accounts before posting. Oops!
My forum posting account is @BobzGamesAlt
LydzWinry
Scratcher
1000+ posts

count instances Reporter

What would this be used for?

Highlight part of my siggy and ctrl+shift+down to see more of it!
Integrity is doing the right thing, even when no one is watching.
-C.S. Lewis
I'm on the cusp of Virgo and Libra and I'm a serious gamer. All hail the almighty snail.
Why Scratch is a social media platform: For context, the topic was a suggestion for better message filtering.
I run The Amethyst Shop 2.0 and ~The Rose Shop!~. NOTICE: THEY ARE BEING MERGED. ONCE THE MERGING HAS OCCURED, THE MERGED SHOP WILL BE ADVERTISED HERE.
Programmer_55
Scratcher
51 posts

count instances Reporter

  • Counting the number of remaining enemies in a grid-based combat game to display in a counter using randomly generated levels.
  • Dynamic data display.
  • Many others that I can't think of off the top of my head.
There's a reason why it's included in practically every other programming language in exsistance.

Old account of Ninji2701. Go check that for more info.
LydzWinry
Scratcher
1000+ posts

count instances Reporter

Programmer_55 wrote:

  • Counting the number of remaining enemies in a grid-based combat game to display in a counter using randomly generated levels.
  • Dynamic data display.
  • Many others that I can't think of off the top of my head.
There's a reason why it's included in practically every other programming language in exsistance.
Ohhh. That makes sense. I'm not a programming expert so I didn't know that lol. Support!

Highlight part of my siggy and ctrl+shift+down to see more of it!
Integrity is doing the right thing, even when no one is watching.
-C.S. Lewis
I'm on the cusp of Virgo and Libra and I'm a serious gamer. All hail the almighty snail.
Why Scratch is a social media platform: For context, the topic was a suggestion for better message filtering.
I run The Amethyst Shop 2.0 and ~The Rose Shop!~. NOTICE: THEY ARE BEING MERGED. ONCE THE MERGING HAS OCCURED, THE MERGED SHOP WILL BE ADVERTISED HERE.
Paddle2See
Scratch Team
1000+ posts

count instances Reporter

It looks like this is a duplicate topic of this one over here so I'll close it to keep the conversation all in one place.

Please use the existing topic in the link above.

Scratch Team Member, kayak and pickleball enthusiast, cat caregiver.

This is my forum signature! On a forum post, it is okay for Scratchers to advertise in their forum signature. The signature is the stuff that shows up below the horizontal line on the post. It will show up on every post I make.
(credit to Za-Chary)



;

Powered by DjangoBB