パーソナルツール

for文

作者: 小見 拓 最終変更 2012年01月08日 12時10分

for文

  • for文のサンプル。
:let var_list = [ "one", "two", "three", "four", "five", "six", "seven" ]
:for item in var_list
    :echo item
:endfor
"# => one
"# => two
"# => three
"# => four
"# => ...
  • for文では「:continue」「:break」を使用できる。
:for item in [ "one", "two", "three", "four", "five", "six", "seven" ]
    :if item == "two"
        :continue
    :endif
    :if item == "five"
        :break
    :endif
    :echo item
:endfor
"# => one
"# => three
"# => four
ドキュメントアクション
コメント
blog comments powered by Disqus