What does // do in Ruby


#1

can anyone tell me what the operator // does?
For example ( 1 == 1 ) && ( 2 == 2 ) // true


#2

its a single line comment


#3

Ruby reads // as a regex (regular expression)

if you do
( 1 == 1 ) && ( 2 == 2 ) // true

you'll get an error unterminated regexp meets end of file

we use # for single line comment in Ruby


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.