Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR TYPESCRIPT

if variable exists python

# If the variable exists at all:
if "myVar" in locals() or globals():
	# `myVar` exists


# If the variable is local: 
if "myVar" in locals():
	# `myVar` is local

# If the variable is global:
if "myVar" in globals():
	# `myVar` is global
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #variable #exists #python
ADD COMMENT
Topic
Name
9+8 =