From: shevegen@... Date: 2017-09-22T03:58:24+00:00 Subject: [ruby-core:82927] [Ruby trunk Bug#13929] TypeError: no implicit conversion of XXXX into string Issue #13929 has been updated by shevegen (Robert A. Heiler). > This causes SO MANY ISSUES! If you build up a String such as: x = 42 y = # String here Then you can use: y = "The answer to everything is #{x}" For global variables this is even shorter, though global variables are not very pretty: $x = 42 # => 42 y = "yo there #$x" # => "yo there 42" In the above, you do not have to manually use .to_s. > Instead of CRASHING It does not "crash". It raises a specific error. I think it as once explained why the behaviour is the way it is; I may not correctly remember though so I don't speculate. (I was thinking of error detection in code being harder.) The recommended way is to use "" with #{} for variables, or any of the alternative variants (the ones with % come to mind but I think #{} is easier to understand than the % variants; just that you get more control via % string formatting e. g. if you need some leading 0 to some float value or something, in one go). ---------------------------------------- Bug #13929: TypeError: no implicit conversion of XXXX into string https://bugs.ruby-lang.org/issues/13929#change-66828 * Author: Anon92929 (Anon Ymous) * Status: Open * Priority: Normal * Assignee: * Target version: * ruby -v: * Backport: 2.2: UNKNOWN, 2.3: UNKNOWN, 2.4: UNKNOWN ---------------------------------------- This causes SO MANY ISSUES! Instead of CRASHING, why doesn't it just apply the .to_s operator in this case??? -- https://bugs.ruby-lang.org/ Unsubscribe: