Index Ai Academy
Glossary · Phase 0 · Tools

Short-circuit evaluation

Also written: short-circuits, short-circuiting

and and or stopping as soon as they know the answer, so the right-hand side may never run.

Try it now

Watch which lines the highlight visits. The first condition is False, so Python moves to the elif. That one is True, so it runs and the else is skipped entirely. Try it again in your head with ctr = 0.01.

Learn it properly

Decisions with if/else · Compare values and choose what happens next. About 40 minutes.

Start this free lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write