cangjie-for

Explain and demonstrate for-in iteration in the Cangjie language.

4|1|Updated Mar 29, 2026
One-click install
npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-for-junjiechen0
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: cangjie-for
Source: https://github.com/JunjieChen0/NJUST/tree/main/.njust-ai/skills/cangjie-for
Command: npx skills add https://github.com/JunjieChen0/NJUST --skill cangjie-for-junjiechen0

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

This Skill clarifies and demonstrates for-in iteration in the Cangjie language, helping learners understand loop syntax, iterator patterns, and practical iteration techniques.

Core Features & Use Cases

  • Syntax and Semantics: explains for (item in sequence) { ... } and how to bind the loop variable.
  • Iterable/Iterator concepts: covers the interfaces and how to obtain and advance iterators.
  • Advanced iteration patterns: describes Range types, where clause filtering, break/continue, tuple destructuring, and custom iterables.

Quick Start

Provide a simple for-in example in Cangjie using a numeric sequence to show how item binding and iteration flow works.

Frequently Asked Questions about cangjie-for

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I write a for-in loop in Cangjie to iterate over a sequence?

A for-in loop in Cangjie uses the syntax `for (item in sequence) { ... }` to bind each element to the loop variable and execute the block. This allows straightforward iteration over any iterable object or range.

What interfaces do I need to implement for custom iterator classes in Cangjie?

Custom iterators in Cangjie require implementing the Iterable and Iterator interfaces. You must provide mechanisms to obtain and advance the iterator, enabling your custom classes to be directly traversable by for-in loops.

Can I filter elements or use break and continue inside a Cangjie for-in loop?

Yes, you can use break to exit and continue to skip iterations within a Cangjie for-in loop. Additionally, the where clause enables inline filtering of elements directly within the loop syntax.

Does Cangjie for-in iteration support tuple destructuring for paired elements?

Yes, Cangjie for-in iteration supports tuple destructuring. This allows you to unpack paired or grouped elements directly into individual variables within the loop header for cleaner data access.