[{"data":1,"prerenderedAt":593},["ShallowReactive",2],{"content-en-\u002Fsyntax\u002Fcontrol-flow":3},{"id":4,"title":5,"body":6,"description":586,"extension":587,"meta":588,"navigation":84,"path":589,"seo":590,"stem":591,"__hash__":592},"content_en\u002Fsyntax\u002Fcontrol-flow.md","Control Flow",{"type":7,"value":8,"toc":577},"minimark",[9,13,30,35,38,176,183,188,290,304,308,311,388,391,450,453,457,473,482,486,492,528,546,550,556,565,573],[10,11,5],"h1",{"id":12},"control-flow",[14,15,16,17,21,22,25,26,29],"p",{},"Structural directives (",[18,19,20],"code",{},"if",", ",[18,23,24],{},"each",") wrap Markdown body text between hyogen comment blocks. Imperative loops run entirely inside ",[18,27,28],{},"@hg"," blocks.",[31,32,34],"h2",{"id":33},"if-else-endif","if \u002F else \u002F endif",[14,36,37],{},"Pug-style — open with a hyogen block, write Markdown, close with another block:",[39,40,45],"pre",{"className":41,"code":42,"language":43,"meta":44,"style":44},"language-markdown shiki shiki-themes github-light github-dark","\u003C!--\n@hg\nconst isNight = true\n@endhg\n-->\n\n\u003C!--\n@hg\nif isNight\n@endhg\n-->\nI can see the full moon.\n\u003C!--\n@hg\nelse\n@endhg\n-->\nI can see the shiny sun.\n\u003C!--\n@hg\nendif\n@endhg\n-->\n","markdown","",[18,46,47,55,61,67,73,79,86,91,96,102,107,112,118,123,128,134,139,144,150,155,160,166,171],{"__ignoreMap":44},[48,49,52],"span",{"class":50,"line":51},"line",1,[48,53,54],{},"\u003C!--\n",[48,56,58],{"class":50,"line":57},2,[48,59,60],{},"@hg\n",[48,62,64],{"class":50,"line":63},3,[48,65,66],{},"const isNight = true\n",[48,68,70],{"class":50,"line":69},4,[48,71,72],{},"@endhg\n",[48,74,76],{"class":50,"line":75},5,[48,77,78],{},"-->\n",[48,80,82],{"class":50,"line":81},6,[48,83,85],{"emptyLinePlaceholder":84},true,"\n",[48,87,89],{"class":50,"line":88},7,[48,90,54],{},[48,92,94],{"class":50,"line":93},8,[48,95,60],{},[48,97,99],{"class":50,"line":98},9,[48,100,101],{},"if isNight\n",[48,103,105],{"class":50,"line":104},10,[48,106,72],{},[48,108,110],{"class":50,"line":109},11,[48,111,78],{},[48,113,115],{"class":50,"line":114},12,[48,116,117],{},"I can see the full moon.\n",[48,119,121],{"class":50,"line":120},13,[48,122,54],{},[48,124,126],{"class":50,"line":125},14,[48,127,60],{},[48,129,131],{"class":50,"line":130},15,[48,132,133],{},"else\n",[48,135,137],{"class":50,"line":136},16,[48,138,72],{},[48,140,142],{"class":50,"line":141},17,[48,143,78],{},[48,145,147],{"class":50,"line":146},18,[48,148,149],{},"I can see the shiny sun.\n",[48,151,153],{"class":50,"line":152},19,[48,154,54],{},[48,156,158],{"class":50,"line":157},20,[48,159,60],{},[48,161,163],{"class":50,"line":162},21,[48,164,165],{},"endif\n",[48,167,169],{"class":50,"line":168},22,[48,170,72],{},[48,172,174],{"class":50,"line":173},23,[48,175,78],{},[14,177,178,179,182],{},"Conditions use the same expression rules as ",[18,180,181],{},"&#123;&#123; &#125;&#125;",". Truthy \u002F falsy follows JavaScript.",[184,185,187],"h3",{"id":186},"else-if","else if",[39,189,191],{"className":41,"code":190,"language":43,"meta":44,"style":44},"\u003C!--\n@hg\nif score >= 90\n@endhg\n-->\nGrade A.\n\u003C!--\n@hg\nelse if score >= 60\n@endhg\n-->\nGrade B.\n\u003C!--\n@hg\nelse\n@endhg\n-->\nGrade C.\n\u003C!--\n@hg\nendif\n@endhg\n-->\n",[18,192,193,197,201,206,210,214,219,223,227,232,236,240,245,249,253,257,261,265,270,274,278,282,286],{"__ignoreMap":44},[48,194,195],{"class":50,"line":51},[48,196,54],{},[48,198,199],{"class":50,"line":57},[48,200,60],{},[48,202,203],{"class":50,"line":63},[48,204,205],{},"if score >= 90\n",[48,207,208],{"class":50,"line":69},[48,209,72],{},[48,211,212],{"class":50,"line":75},[48,213,78],{},[48,215,216],{"class":50,"line":81},[48,217,218],{},"Grade A.\n",[48,220,221],{"class":50,"line":88},[48,222,54],{},[48,224,225],{"class":50,"line":93},[48,226,60],{},[48,228,229],{"class":50,"line":98},[48,230,231],{},"else if score >= 60\n",[48,233,234],{"class":50,"line":104},[48,235,72],{},[48,237,238],{"class":50,"line":109},[48,239,78],{},[48,241,242],{"class":50,"line":114},[48,243,244],{},"Grade B.\n",[48,246,247],{"class":50,"line":120},[48,248,54],{},[48,250,251],{"class":50,"line":125},[48,252,60],{},[48,254,255],{"class":50,"line":130},[48,256,133],{},[48,258,259],{"class":50,"line":136},[48,260,72],{},[48,262,263],{"class":50,"line":141},[48,264,78],{},[48,266,267],{"class":50,"line":146},[48,268,269],{},"Grade C.\n",[48,271,272],{"class":50,"line":152},[48,273,54],{},[48,275,276],{"class":50,"line":157},[48,277,60],{},[48,279,280],{"class":50,"line":162},[48,281,165],{},[48,283,284],{"class":50,"line":168},[48,285,72],{},[48,287,288],{"class":50,"line":173},[48,289,78],{},[14,291,292,293,295,296,299,300,303],{},"Empty branches (no body) are allowed. Unmatched ",[18,294,20],{}," or extra ",[18,297,298],{},"endif"," causes ",[18,301,302],{},"parse_error",".",[31,305,307],{"id":306},"each-endeach","each \u002F endeach",[14,309,310],{},"Loop over arrays or iterable-like values. Body is Markdown between blocks:",[39,312,314],{"className":41,"code":313,"language":43,"meta":44,"style":44},"\u003C!--\n@hg\nconst fruits = [\"apple\", \"banana\", \"orange\"]\n@endhg\n-->\n\n\u003C!--\n@hg\neach item in fruits\n@endhg\n-->\n- {{ item }}\n\u003C!--\n@hg\nendeach\n@endhg\n-->\n",[18,315,316,320,324,329,333,337,341,345,349,354,358,362,367,371,375,380,384],{"__ignoreMap":44},[48,317,318],{"class":50,"line":51},[48,319,54],{},[48,321,322],{"class":50,"line":57},[48,323,60],{},[48,325,326],{"class":50,"line":63},[48,327,328],{},"const fruits = [\"apple\", \"banana\", \"orange\"]\n",[48,330,331],{"class":50,"line":69},[48,332,72],{},[48,334,335],{"class":50,"line":75},[48,336,78],{},[48,338,339],{"class":50,"line":81},[48,340,85],{"emptyLinePlaceholder":84},[48,342,343],{"class":50,"line":88},[48,344,54],{},[48,346,347],{"class":50,"line":93},[48,348,60],{},[48,350,351],{"class":50,"line":98},[48,352,353],{},"each item in fruits\n",[48,355,356],{"class":50,"line":104},[48,357,72],{},[48,359,360],{"class":50,"line":109},[48,361,78],{},[48,363,364],{"class":50,"line":114},[48,365,366],{},"- {{ item }}\n",[48,368,369],{"class":50,"line":120},[48,370,54],{},[48,372,373],{"class":50,"line":125},[48,374,60],{},[48,376,377],{"class":50,"line":130},[48,378,379],{},"endeach\n",[48,381,382],{"class":50,"line":136},[48,383,72],{},[48,385,386],{"class":50,"line":141},[48,387,78],{},[14,389,390],{},"Object arrays:",[39,392,394],{"className":41,"code":393,"language":43,"meta":44,"style":44},"\u003C!--\n@hg\neach item in data\n@endhg\n-->\n\n- {{ item.key }} is {{ item.value }}\n\n\u003C!--\n@hg\nendeach\n@endhg\n-->\n",[18,395,396,400,404,409,413,417,421,426,430,434,438,442,446],{"__ignoreMap":44},[48,397,398],{"class":50,"line":51},[48,399,54],{},[48,401,402],{"class":50,"line":57},[48,403,60],{},[48,405,406],{"class":50,"line":63},[48,407,408],{},"each item in data\n",[48,410,411],{"class":50,"line":69},[48,412,72],{},[48,414,415],{"class":50,"line":75},[48,416,78],{},[48,418,419],{"class":50,"line":81},[48,420,85],{"emptyLinePlaceholder":84},[48,422,423],{"class":50,"line":88},[48,424,425],{},"- {{ item.key }} is {{ item.value }}\n",[48,427,428],{"class":50,"line":93},[48,429,85],{"emptyLinePlaceholder":84},[48,431,432],{"class":50,"line":98},[48,433,54],{},[48,435,436],{"class":50,"line":104},[48,437,60],{},[48,439,440],{"class":50,"line":109},[48,441,379],{},[48,443,444],{"class":50,"line":114},[48,445,72],{},[48,447,448],{"class":50,"line":120},[48,449,78],{},[14,451,452],{},"Loop variables and parent scope are both visible inside the body.",[31,454,456],{"id":455},"nesting-limit","Nesting limit",[14,458,459,461,462,464,465,469,470,303],{},[18,460,20],{}," and ",[18,463,24],{}," structural nesting is limited to ",[466,467,468],"strong",{},"20 levels combined",". Exceeding the limit skips the block and emits ",[18,471,472],{},"nest_limit_exceeded",[14,474,475,476,478,479,481],{},"Nested ",[18,477,20],{}," inside ",[18,480,24],{}," (and vice versa) is allowed within the limit.",[31,483,485],{"id":484},"c-style-for-and-dowhile","C-style for and do…while",[14,487,488,489,491],{},"These run entirely inside ",[18,490,28],{}," blocks (no Markdown body between markers):",[39,493,495],{"className":41,"code":494,"language":43,"meta":44,"style":44},"\u003C!--\n@hg\nfor (let i = 0; i \u003C 3; i++) {\n  \u002F\u002F imperative logic only\n}\n@endhg\n-->\n",[18,496,497,501,505,510,515,520,524],{"__ignoreMap":44},[48,498,499],{"class":50,"line":51},[48,500,54],{},[48,502,503],{"class":50,"line":57},[48,504,60],{},[48,506,507],{"class":50,"line":63},[48,508,509],{},"for (let i = 0; i \u003C 3; i++) {\n",[48,511,512],{"class":50,"line":69},[48,513,514],{},"  \u002F\u002F imperative logic only\n",[48,516,517],{"class":50,"line":75},[48,518,519],{},"}\n",[48,521,522],{"class":50,"line":81},[48,523,72],{},[48,525,526],{"class":50,"line":88},[48,527,78],{},[14,529,530,533,534,537,538,541,542,545],{},[18,531,532],{},"while"," alone, ",[18,535,536],{},"for…of",", and ",[18,539,540],{},"for…in"," are ",[466,543,544],{},"not"," allowed.",[31,547,549],{"id":548},"ternary-in-expressions","Ternary in expressions",[14,551,552,553,555],{},"For simple branching in text, prefer ternary inside ",[18,554,181],{},":",[39,557,559],{"className":41,"code":558,"language":43,"meta":44,"style":44},"{{ isNight ? \"Dark\" : \"Light\" }}\n",[18,560,561],{"__ignoreMap":44},[48,562,563],{"class":50,"line":51},[48,564,558],{},[14,566,567,568,303],{},"See ",[569,570,572],"a",{"href":571},"\u002Fen\u002Fsyntax\u002Fexpressions","Expressions",[574,575,576],"style",{},"html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":44,"searchDepth":57,"depth":57,"links":578},[579,582,583,584,585],{"id":33,"depth":57,"text":34,"children":580},[581],{"id":186,"depth":63,"text":187},{"id":306,"depth":57,"text":307},{"id":455,"depth":57,"text":456},{"id":484,"depth":57,"text":485},{"id":548,"depth":57,"text":549},"if, else, else if, each, and C-style loops in hyogen blocks.","md",{},"\u002Fsyntax\u002Fcontrol-flow",{"title":5,"description":586},"syntax\u002Fcontrol-flow","MsnCwB8ORa7OiMiSeFxhJJFP8YAd6hW9KWyX_B5AbfU",1787223114993]