blockly > Procedures > isNameUsed
Procedures.isNameUsed() function
Return if the given name is already a procedure name.
Signature:
export declare function isNameUsed(name: string, workspace: Workspace, opt_exclude?: Block): boolean;
Parameters
Parameter |
Type |
Description |
name |
string |
The questionable name. |
workspace |
Workspace |
The workspace to scan for collisions. |
opt_exclude |
Block |
(Optional) Optional block to exclude from comparisons (one doesn't want to collide with oneself). |
Returns:
boolean
True if the name is used, otherwise return false.
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[null,null,["Last updated 2024-09-18 UTC."],[[["Determines if a given name is already in use as a procedure name within a specific workspace."],["Accepts the name to check, the workspace to search within, and an optional block to exclude from the comparison."],["Returns `true` if the name is already assigned to a procedure, `false` otherwise."]]],["The `Procedures.isNameUsed()` function checks if a given name is already in use as a procedure name within a specified workspace. It accepts the name (a string), the workspace to be checked, and optionally, a block to exclude from the comparison. The function returns `true` if the name is in use and `false` if the name is free. The function is useful to check name collision.\n"]]