Stay organized with collections
Save and categorize content based on your preferences.
blockly > Variables > promptName
Variables.promptName() function
Prompt the user for a new variable name.
Signature:
export declare function promptName(promptText: string, defaultText: string, callback: (p1: string | null) => void): void;
Parameters
Parameter |
Type |
Description |
promptText |
string |
The string of the prompt. |
defaultText |
string |
The default value to show in the prompt's field. |
callback |
(p1: string | null) => void |
A callback. It will be passed the new variable name, or null if the user picked something illegal. |
Returns:
void
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."],[[["`promptName` is a function that prompts the user for a new variable name, taking the prompt text, default text, and a callback function as parameters."],["The callback function receives the new variable name or null if the user's input is invalid."],["This function is part of the `Variables` namespace in Blockly and is used to create new variables with user-defined names."]]],[]]