Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Limitations of eval
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Robert Klemme, post: 4469869"] *eval grin* My guess is that the string probably contained something different than Adelle expected. Adelly, did you try to output your string with "p" before you eval it? Might be interesting to see what's really in there. As an illustration what I mean: (eval):1: warning: parenthesize argument(s) for future version SyntaxError: (eval):1:in `irb_binding': compile error (eval):1: syntax error unless thing puts 'y' else puts 'n' end ^ (eval):1: syntax error unless thing puts 'y' else puts 'n' end ^ from (irb):9 from (irb):9n => nil I.e. you probably do not have the line breaks in your string and since you don't use "then" syntax is not correct. It doesn't work in a normal line without "then" also: (irb):11: warning: parenthesize argument(s) for future version SyntaxError: compile error (irb):11: syntax error unless thing puts 'y' else puts 'n' end ^ (irb):11: syntax error from (irb):11 Kind regards robert [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Limitations of eval
Top