For example, a simple check for an empty string:
if s == "" { return 0 }
Or, a for-loop to pre-fill an array with -1 (I don't think there's an easier way to do this):
for i := range m { m[i] = -1 }
Is this generally discouraged, even if these functions are extremely simple altogether? I don't mean to be pedantic, but am generally curious what the sentiment for this is.
Aucun commentaire:
Enregistrer un commentaire