Useful alternative control structures?

后端 未结 28 925
礼貌的吻别
礼貌的吻别 2021-01-30 02:20

Sometimes when I am programming, I find that some particular control structure would be very useful to me, but is not directly available in my programming language. I think my

28条回答
  •  后悔当初
    2021-01-30 03:02

    I think I should mention CityScript (the scripting language of CityDesk) which has some really fancy looping constructs.

    From the help file:

    {$ forEach n var in (condition) sort-order $}
    ... text which appears for each item ....
    {$ between $}
    .. text which appears between each two items ....
    {$ odd $}
    .. text which appears for every other item, including the first ....
    {$ even $}
    .. text which appears for every other item, starting with the second ....
    {$ else $}
    .. text which appears if there are no items matching condition ....
    {$ before $}
    ..text which appears before the loop, only if there are items matching condition
    {$ after $}
    ..text which appears after the loop, only of there are items matching condition
    {$ next $}
    

提交回复
热议问题