Assuming I have a model named “Person” & that person is defined by name, age, gender & race.
How do I iterate through the model to find out which values are nil?
For example:
name: peter
age: 34
gender: nil
race: nil
–Nil count: 2–
I understand I would have iterate through each field, do a +1 if value if nil & output the total value.
Thanks for any help or guidance!
If your instance is
pthen:will give you the number of
nilattributes.