2007/8/14, sean liu <seanliugm / gmail.com>:
> hi, all
>
> today i defined a class like this:
> class C
>   AB = 10
>   def self.set(value)
>      AB = value
>   end
> end
> then i got this error: SyntaxError: compile error (irb):10: dynamic constant
> assignment.
> Constants can be changed after initialization, but what does this error
> mean?
> Any explanations will be appreciated.
>

Variable AB is a contant, because it starts with a capital letter.
You can only assign a contant value (or expression) to it, once.