from programmer → to computer scientist
thinking about engineering to scale — what if we have 1000 inputs? 1000000 inputs?
some relaxation on style guide compared to COMP1511, but still required to follow the style guide
e.g.
using assignment statements in expressions
an assignment statement will return the value that is assigned
e.g.
ternary operators
x = c ? e1 : e2;
(if c is true, x = e1; else, x = e2)
e.g.
ditch curly brackets if only one statement after if
if (x > 0)
char *y = "yolo";
e.g.
using ternary operators in for loops
for (int i = start; (start <= end) ? i <= end : i >= end; i += step) { // do stuff }
another way to write loops in a more ‘compact’ way
for (init, condition, increment) {}