Variable declarations


#1

This should not work because i haven’t declared the number variable but it does, why?

String my_name
my_name = “Jamie”

my_age = 26
puts my_name
print my_age



Replace this line with your code. 



#2

Ruby does not have variable declarations.

BTW, your statement

String my_name

will generate an error unless my_name already exists at this point of
execution.


#3

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.