blockly > VariableMap > getVariable
Metoda ZmiennaMap.getZmienna()
Znajdź zmienną według podanej nazwy, wpisz jej typ i zwróć ją. Jeśli nie zostanie znaleziony, ustaw wartość null.
Podpis:
getVariable(name: string, opt_type?: string | null): VariableModel | null;
Parametry
Parametr |
Typ |
Opis |
nazwa |
ciąg znaków |
Nazwa do sprawdzenia. |
opt_type |
ciąg znaków | wartość null |
(Opcjonalnie) Typ zmiennej. Jeśli nie zostanie podany, domyślnie używany będzie pusty ciąg, który jest konkretnym typem. |
Zwroty:
VariableModel | wartość null
Zmienna o podanej nazwie lub wartość null, jeśli nie została znaleziona.
O ile nie stwierdzono inaczej, treść tej strony jest objęta licencją Creative Commons – uznanie autorstwa 4.0, a fragmenty kodu są dostępne na licencji Apache 2.0. Szczegółowe informacje na ten temat zawierają zasady dotyczące witryny Google Developers. Java jest zastrzeżonym znakiem towarowym firmy Oracle i jej podmiotów stowarzyszonych.
Ostatnia aktualizacja: 2024-08-22 UTC.
[null,null,["Ostatnia aktualizacja: 2024-08-22 UTC."],[[["The `getVariable()` method searches for a variable within the VariableMap by its name and optionally by its type."],["If a matching variable is found, the method returns a `VariableModel` object representing that variable; otherwise, it returns `null`."],["The `name` parameter is mandatory and specifies the name of the variable to search for."],["The `opt_type` parameter is optional and specifies the type of the variable; if not provided, it defaults to the empty string, which represents a specific type in Blockly."]]],[]]