Blocks - implement "item # of [string] in [drop down]" reporter
See original GitHub issueImplement 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:
- Created 6 years ago
- Reactions:6
- Comments:7 (4 by maintainers)
Top 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 >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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
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: