Formal argument cannot be a constant

Hello …

Constants start with an uppercase letter in ruby.

This is a ruby carry over but I did not know about it.

It seems not so common in some other programming languages I know.
Especially for parameter/argument names it seems to me an
unexpected underlying syntactical restriction.

In some typed languages (e.g. c,c++,c# ) I can meaningfully
restrict parameters to be constant.

It also seems not to be mentioned in SP help system explicitly.

Rather the other way:

You may use any words you want for the parameter names.

I came about it while I was trying to develop the following simple
example:

define :mplay do |Melody|
  Melody.each do |note, pause|
    play note
    sleep pause
  end
end

godownmoses = [[:d4, 1],
               [:bb4, 1],
               [:bb4, 1],
               [:a4,  1],
               [:a4,  1],
               [:bb4, 1],
               [:bb4, 1],
               [:g4,  2]]

mplay godownmoses

Try it with “melody” and it works.

So

define :mplay do |melody|
  melody.each do |Note, Pause|
    play Note
    sleep Pause
  end
end

does not work either.

JFI

define :mplay do |melody|
  melody.each do |note, pause|
    play note
    sleep pause
  end
end

All in lowercase