Skip to main content Link Search Menu Expand Document (external link)

if vs static if Quiz

Question

Why is the message 20 is prime!... Wait, what? also printed?

Because it is printed inside a regular if body, which the compiler doesn’t evaluate

Correct!

Because the code in a unittest block is alwats generated

The compiler only evaluates and generates code according to static ifs, not regular ifs. The bodies of regular ifs are always generated

Because the isPrime function contains a bug

The compiler only evaluates and generates code according to static ifs, not regular ifs. The bodies of regular ifs are always generated