Ruby Language Methods Required default optional parameter mix

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Insert
> Step 2: And Like the video. BONUS: You can also share it!

Example

def my_mix(name,valid=true, *opt)
    puts name
    puts valid
    puts opt
end

Call as follows:

my_mix('me')
# 'me'
# true
# []

my_mix('me', false)
# 'me'
# false
# []

my_mix('me', true, 5, 7) 
# 'me'
# true
# [5,7]


Got any Ruby Language Question?