Skip to main content
2 of 3
added 230 characters in body
Carl Woll
  • 131.7k
  • 6
  • 246
  • 359

Update

I was reading the comments to the question, and found that @Kuba had already provided the following answer. I think it's the cleanest solution, so it deserves to be an answer, but please credit him with the idea.

Another idea is to use PatternSequence:

ClearAll[f]

f[PatternSequence[a_,b_,c_]?NumericQ] := a+b+c

Examples:

f[1,2,3]
f["a",2,3]

6

f["a", 2, 3]

Carl Woll
  • 131.7k
  • 6
  • 246
  • 359