Stay organized with collections
Save and categorize content based on your preferences.
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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[],["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"]]