Flowchart (ISO 5807)
Source code
TypeScript
function isPrime(n: number): boolean {
if (n < 2) return false;
for (let i = 2; i * i <= n; i++) {
if (n % i === 0) return false;
}
return true;
}The editor opens with this code — change it and the chart redraws.
- Language
- TypeScript
- Constructs
- loop with early return
- Topic
- Algorithms
- Formats
- Word, Visio, draw.io, PDF, SVG