# What is Induction Variable

I found an unfamiliar method when I looked into the LLVM documentation, getInductionVariable. I could see a similar name in MLIR scf (Static Control Flow) dialect as well.

The operation defines an SSA value for its induction variable.

What is an induction variable?

Wikipedia gave me a clear description of what the induction variable is.

In computer science, an induction variable is a variable that gets increased or decreased by a fixed amount on every iteration of a loop or is a linear function of another induction variable

That’s not limited to the value written in the for loop incrementally updated. All variables updated iteratively in the loop can be seen as induction variables.

for (i = 0; i < 10; ++i) {
j = 17 * i;
}


i' and j are both induction variables in the previous case.

Induction variables are represented as region argument in MLIR mlir::scf::ForOp`. Hence they are assumed to be passed from the outside of the region.