Viml loops

From wikinotes
Revision as of 16:15, 10 May 2019 by Will (talk | contribs) (→‎For Loops)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

For Loops

" Iterate Through Lists
for l in ['a','b','c']
	echo l
endfor
"Iterate Through Dicts
for [next_key, next_val] in items(dict)
    let result = process(next_val)
    echo "Result for " next_key " is " result
endfor

While Loops

" Index based iteration
let i=0
while i < 10
	echo i
	i +=1
endwhile