Fall 2024 - P1
Big Idea 3 | .1 | .2 | .3 | .4 | .5 | .6 | .7 | .8 | .10 |
3.1 Variables and Strings
Team Teach String Operations
- What is a Variable
- Defining a Variable
____________________________________________________________________________________________________________________________________________
What is a Variable
Defining a Variable
# define your variables
x = 'ruffs'
y = 24
# print variables
print(x)
print(y)
unicorn
24
%%js
// define variables
let x = 'ruffs'; // defines a var, can be updated but not re-declared in the same scope
const u = 24; // defines a block-scoped constant, cannot be updated or re-declared.
var w = ['h', 'i']; // defines a var, can be updated or re-declared. It’s function-scoped
// log variables in console
console.log(x);
console.log(u);
console.log(w);