From: Philipp Altmann Date: 2011-09-06T18:11:47+09:00 Subject: Conditional expression and return Hi guys, this is my Code: def getRegex(string) if @HashMapWithAllRegex.has_key?(string) ? (@HashMapWithAllRegex.fetch(string) : raise(ArgumentError, "This regex is not specified") end end Error Message: SyntaxError: /Users/Philipp/Documents/projects/objcdoc/src/RegexProvider.rb:19: syntax error, unexpected tIVAR if @HashMapWithAllRegex.has_key?(string) ? return @HashMapWithAllRegex.fetch(string : raise(ArgumentError, "This regex is not specified") ^ require at org/jruby/RubyKernel.java:1038 (root) at /Users/Philipp/Documents/projects/objcdoc/src/RegexProvider.rb:6 require at org/jruby/RubyKernel.java:1038 (root) at /Users/Philipp/Documents/projects/objcdoc/src/Main.rb:1 Why will this don't work? I think in Java will this construct work :-). I hope you can explain me why this isnt't working in ruby. Greetings Philipp -- Posted via http://www.ruby-forum.com/.