Who has the highest precedence here ?

4 interesting examples using operator precedence in Ruby

Mehdi Farsi
Jan 2 · 4 min read

Introduction

method 'arg' and return

"method1"

method1 || method2 'hello'

variable = a or b

block {..} vs block do..end

method2 received block? true
method1 received block? false
method2 received block? false
method1 received block? true

May I have your attention please 🎤🎤

Feel free to subscribe here: www.rubycademy.com


rubycademy

E-Learning platform for Ruby and Ruby on Rails

Mehdi Farsi

Written by

Founder of www.rubycademy.com — I blog about Ruby & ROR - Paris

rubycademy

E-Learning platform for Ruby and Ruby on Rails