Viml conditionals: Difference between revisions

From wikinotes
Line 30: Line 30:
</source>
</source>


</syntaxhighlight>
</blockquote><!-- If Statements -->
</blockquote><!-- If Statements -->

Revision as of 19:55, 26 June 2022

WARNING:

in vim, 0 is FALSE, and 1 is TRUE.

If Statements

" If Statement
if var == 1
    echo var
elseif var == 2 || var == 3
    echo var
else
    echo var
endif
" If Not Statement
if !(var == 1)
    echom "var doesn't equal 1"
endif
" If And Statement
if var == 1 && var != 0
    echom "condition satisfied
endif