NapkinCalc

Start Here — A Complete Tour

Names, subscripts & arrays

continues from lesson 2 — values defined earlier in the course stay live here

Two naming ideas worth knowing early:

  • Subscripts are part of the name. Type v_max (a letter, underscore, then more) and you get the single variable v-max — not "v indexed by max". Subscripts are how engineers write R_1, T_in, v_max, and they never collide with a unit.
  • Brackets are array indexing. readings[0] pulls an element out of a list, counting from 0.
vmax=12v_{max} = 12 one variable named v_max — the subscript is just part of the name
readings:=[10,20,30,40]readings := [10, 20, 30, 40] = [10,20,30,40][10, 20, 30, 40] a list / vector
firstreading:=readings[0]first_{reading} := readings[0] = 1010 index 0 is the first element
thirdreading:=readings[2]third_{reading} := readings[2] = 3030 index 2 is the third
✓ pass firstreading==10andthirdreading==30first_{reading} == 10 and third_{reading} == 30 indexing counts from zero