Explore what CodeHS has to offer for districts, schools, and teachers.
Click on one of our programs below to get started coding in the sandbox!
View All
What is the main difference between local and global variables?
Local variables can only be accessed where they are created whereas global variables can be accessed anywhere.
Local variables are much smaller in size compared to global variables.
Local variables can change their values whereas global variables cannot change their values.
Local variables can only be used once whereas global variables can be used multiple times.