Constants cannot be defined in methods
suggest changedef say_hi
MESSAGE = "Hello"
puts MESSAGE
end
The above code results in an error: SyntaxError: (irb):2: dynamic constant assignment
.
Found a mistake? Have a question or improvement idea?
Let me know.
Constants cannot be defined in methods
Table Of Contents
3 Arrays
4 Classes
5 Hashes
9 Strings
10 Symbols
11 Exceptions
12 Thread
13 Methods
15 Numbers
16 Iteration
18 Comparable
19 Gem usage
22 Range
23 Comments
24 Operators
25 Operators
27 Modules
30 Constants
32 rbenv
34 Singletons
35 File I/O
36 Time
37 Queue
39 IRB
40 Enumerators
41 C extensions
42 Struct
48 DateTime
49 Truthiness
55 Refinements
59 Debugging
61 Recursion
62 Installation
63 ERB
67 OptionParser
70 Enumerable
73 Contributors