Quick actions

cmd+k|ctrl+k

Navigation

Languages

Untitled

Snippet info

Language

Nim

Visibility

unlisted

Author

legacy-anonymous

Created

2017-05-27T10:47:42Z

Updated

2017-05-27T10:47:42Z

template hasField(t, f): bool =
  var res = false
  for field, _ in fieldPairs(t()):
    res = res or field == f
  res
    
    
type Test = object
  i: int
  
static:
  echo hasField(Test, "i")
  echo hasField(Test, "count")
INFO