mlld
Version:
mlld: llm scripting language
37 lines (32 loc) • 898 B
Markdown
---
id: mistake-complex-logic
title: Complex Logic Inline
brief: Extract heavy logic to helpers or modules
category: mistakes
parent: mistakes
tags: [mistakes, complexity, helpers, modules]
related: [exe-blocks, modules-philosophy]
related-code: []
updated: 2026-01-05
---
Move heavy logic to helpers or modules. Keep orchestration simple.
```mlld
>> Wrong (too much logic inline)
var = for in => when first [
.type == "a" && .status == "active" => [
let = .value * 2
let =
let =
=> when [ .ok => .value * => null ]
]
* => null
]
>> Correct (extract to helper)
exe = [
let = .value * 2
let =
let =
=> when [ .ok => .value * => null ]
]
var = for in when .type == "a" =>
```