Project

General

Profile

Actions

Bug #16140

closed

non-typed variable

Added by professeurx (Françoys Proulx) almost 6 years ago. Updated almost 6 years ago.

Status:
Rejected
Assignee:
-
Target version:
-
ruby -v:
ruby 2.5.5p157 (2019-03-15 revision 67260) [x86_64-linux-gnu]
[ruby-core:94768]

Description

I not sure if it's a bug. But maybe it is.

a =  2
puts a

a = "two"
puts a

=> 2
=> two

I was expecting it to produce an error. After all, Ruby is supposed to be a dynamically typed language. Clearly for variables, it's not the case. if it's not a bug, it is possibly an option to be added to the interpreter.

Actions

Also available in: Atom PDF

Like0
Like0Like0