Ruby | Integer << function Last Updated : 19 Mar, 2024 Improve Improve Like Article Like Save Share Report The << is an inbuilt method in Ruby returns the number which is shifted N times to the left. The resultant number is num * (2^N). Syntax: num << N Parameters: The function accepts no parameter. Return Value: It returns num * (2^N). Example 1: # Ruby program for << method in Integer # Initialize numbers num1 = 6 num2 = 3 # Prints << print num1 << num2 Output: 48 Example 2: # Ruby program for << method in Integer # Initialize numbers num1 = 2 num2 = 2 # Prints << print num1 << num2 Output: 8 Like Article Suggest improvement Previous Ruby Integer to_f function with example Next Ruby | Rational rational() function() Share your thoughts in the comments Add Your Comment Please Login to comment...