Skip to content
Back to skills

Cairo Control Flow

ASecurity

Explain Cairo control flow with `if`, `else`, `loop`, `while`, `for`, `break`, and `continue`; use when a request involves conditionals, loops, or loop return values in Cairo.

  • 2 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added September 27, 2026
documentationexpress

Security analysis

A100/100

Pro scans all 2 files and shows the line behind each finding

Scanned September 27, 2026

npx -y skills add David-Li0406/meta-skill-evloving --skill cairo-control-flow --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Cairo Control Flow?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Cairo Control Flow
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/david-li0406-cairo-control-flow/badge)](https://www.skillsdirectory.com/skills/david-li0406-cairo-control-flow)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: cairo-control-flow
description: Explain Cairo control flow with `if`, `else`, `loop`, `while`, `for`, `break`, and `continue`; use when a request involves conditionals, loops, or loop return values in Cairo.
---

# Cairo Control Flow

## Overview
Explain Cairo conditional logic and loops with correct syntax and typing rules.

## Quick Use
- Read `references/control-flow.md` before answering.
- Show short examples of `if` expressions and each loop type (`loop`, `while`, `for`).
- Emphasize that `if` conditions must be `bool` and that `loop` can return a value with `break`.

## Response Checklist
- Ensure `if` conditions are boolean and branches return the same type when used as an expression.
- Pick the right loop: `loop` for indefinite repetition, `while` for condition-based, `for` for ranges/iterators.
- Mention `break`/`continue` and `break value` when returning from a loop.

## Example Requests
- "Why can't I use an integer as an if condition in Cairo?"
- "How do I return a value from a loop?"
- "How do I write a for loop over a range?"

## Cairo by Example
- [Flow of Control](https://cairo-by-example.xyz/flow_control)
- [if/else](https://cairo-by-example.xyz/flow_control/if_else)
- [loop](https://cairo-by-example.xyz/flow_control/loop)
- [while](https://cairo-by-example.xyz/flow_control/while)
- [for and range](https://cairo-by-example.xyz/flow_control/for)
- [Expressions](https://cairo-by-example.xyz/expression)

Files in this skill

  • SKILL.md1.4 KB
  • references/control-flow.md947 B

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…