question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blocks - implement "item # of [string] in [drop down]" reporter

See original GitHub issue

Implement new reporter as per discussions with the resources team. Essentially this reporter simplifies finding the index of an item in a list by it’s value. In the event that multiple items in the list exactly match the supplied string the reporter will return the first index. In the event that no item exists that exactly matches the supplied string the reporter will return 0.

Block Spec

item # of [string] in [drop down]

Defaults

item # of [thing] in [list]

Drop-down

  • [dynamic list of lists]

Position

The new reporter should be added to the data category below the item (drop down) of [drop down] reporter.

Reference

/cc @ntlrsk @carljbowman

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:6
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

2reactions
mrjacobbloomcommented, Aug 11, 2017

Since scratch generally ignores case, I’d expect this block to be completely case-insensitive. That said, it’d be really handy to have another set of blocks that can be used to test case so we could do this manually if needed

1reaction
griffpatchcommented, Aug 11, 2017

I just wondered, what about the case where you have a list containing a mixture of upper and lowercase versions of the same string. If you ask for the index of one particular string and it matches exactly to one, but only case insensitively to another, should it return the index of the exact match? or always the first matching one?

On 11 August 2017 at 01:45, Jacob notifications@github.com wrote:

Dictionaries here we come

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/LLK/scratch-gui/issues/600#issuecomment-321709756, or mute the thread https://github.com/notifications/unsubscribe-auth/AGbNvnJjzazPRMN06O5LSYdId6_9n7xPks5sW6QMgaJpZM4OyzIm .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reporter Block - Scratch Wiki
A reporter block is a block that reports a value. These can be anything, from numbers to strings. Unlike a stack block, which...
Read more >
"Create own block" dropdown list - Discuss Scratch
A list item of the form (number) string would produce menu options like in the direction block. Thus, each drop-down menu in a...
Read more >
Dropdown fields | Blockly - Google Developers
The dropdown field stores a string as its value and a string as its text. The value is a language-neutral key that will...
Read more >
Snap! Cheat Sheet - The Beauty and Joy of Computing
In Snap!, you must first create a variable before you use assign it a value. ... In addition, there is a drop-down menu...
Read more >
Defining blocks - Microsoft MakeCode
To define a block that has both a reporter and a statement form, use the blockAliasFor comment attribute: ... create an enum with...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found