Ruby Function with a star (asterisk)
-
splat
-
-
asterisk
-
The
*
is thesplat
operator it is slurpy, it will take any number of parameters -
AKA single splat
def with_splat(*things)
puts things.class
end
with_splat()
with_splat("Name", 23)
Press ← or → to navigate between chapters
Press S or / to search in the book
Press ? to show this help
Press Esc to hide this help
splat
asterisk
The *
is the splat
operator it is slurpy, it will take any number of parameters
AKA single splat
def with_splat(*things)
puts things.class
end
with_splat()
with_splat("Name", 23)