Skip to main content
edited tags
Link
Dom
  • 3.4k
  • 5
  • 21
  • 39
Source Link
TamaMcGlinn
  • 846
  • 4
  • 19

How to check if value is v:null?

What is the proper way to check if a particular variable is null? I use v:null as a special value to indicate something in a custom function's return value.

I have tried:

let l:v = v:null
echom l:v == v:null   " Works fine
let l:v = {'file': "something"}
echom l:v == v:null   " E735: Can only compare Dictionary with Dictionary

Note for searchers: null is sometimes called None, empty or nil.