Item number of () in (): Difference between revisions

From PenguinMod Wiki
Jump to navigation Jump to search
Content added Content deleted
(Created page with "{{Infobox Block |category = Lists |title = item # of () in () |block_name = item # of [] in [ v] |block_type = Reporter Block }} {{Incorrect Title|item # of () in ()}} The '''item # of () in ()''' block is a reporter block in the Lists category that reports the item number of the first occurrence of the inputted item in the selected list. It was introduced in Scratch 3.0. ==Workaround== This block can be worked around using the following code: <scratchblocks> def...")
 
No edit summary
 
Line 6: Line 6:
}}
}}
{{Incorrect Title|item # of () in ()}}
{{Incorrect Title|item # of () in ()}}
The '''item # of () in ()''' block is a reporter block in the [[Lists]] category that reports the item number of the first occurrence of the inputted item in the selected list. It was introduced in Scratch 3.0.
The '''item # of () in ()''' block is a reporter block in the [[Lists]] subcategory that reports the item number of the first occurrence of the inputted item in the selected list. It was introduced in Scratch 3.0.
==Workaround==
==Workaround==
This block can be worked around using the following code:
This block can be worked around using the following code:
Line 19: Line 19:
return (item number) ::custom cap
return (item number) ::custom cap
</scratchblocks>
</scratchblocks>
[[Category:Reporter Blocks]]
[[Category:Vanilla Blocks]]
[[Category:List Blocks]]

Latest revision as of 21:51, 25 June 2024

item # of () in ()
item # of [] in [ v]
Caption
Block Type Reporter Block
Category / Extension Lists
Status Who tf uses status
The correct title of this article is item # of () in (). PenguinMod Wiki uses Item number of () in () instead because of technical restrictions.

The item # of () in () block is a reporter block in the Lists subcategory that reports the item number of the first occurrence of the inputted item in the selected list. It was introduced in Scratch 3.0.

Workaround

This block can be worked around using the following code:

define find item # of (string1)
set [item number v] to [0] //keep track of the item in the list
if <[list v] contains (string1)?> then
repeat until <(item (item number) of [list v]) = (string1)>
change [item number v] by (1)
end
end
return (item number) ::custom cap