Is that true? The loop is a branch.
The machine?
A loop contains a branch - keep looping or break. At least according to structured programming -- https://en.wikipedia.org/wiki/Structured_program_theorem.
interesting question...
> A loop is a chunk of code that will be run N times depending
oh! turns out you do!
for (fn, n) = {
stop = void (i) {}
run = void (i) { fn(i); go(i + 1) }
go = void (i) { *((i < n) * &run + (i >= n) * &stop)(i) }
go(0)
}
Or you could write all the implementations for each possible n and dispatch through a registry.Just a simple example, but the conditional branch occurs on line 14 of the generated assembly. It does a comparison (line 13) and then a conditional jump (jl, line 14).
Anyone who started out programming in assembly languages
The CPU.