ruby get.chomp.to_i doesn't work, doesn't load

Introduction

ruby beginner, get.chomp.to_i does not read.

$ ruby index.rb class.rb
# index.rb
require "./class"

count = get.chomp.to_i
puts count

When I execute, 0 is automatically entered in the count where count = get.chomp.to_i.

Solution

The execution method was different. Since it is written as require" / menu ",

$ ruby index.rb

It was OK only. It read it properly.

Recommended Posts

ruby get.chomp.to_i doesn't work, doesn't load
The program doesn't work, the program doesn't stop ...
@ClassRules doesn't work with PowerMockRunner
Arrays.asList (int []). Contains (int) doesn't work
Breakpoint doesn't work when running Rails Minitest in Ruby Test Explorer
[Beginner] When rails s doesn't work
When PyCall doesn't work with PyCall :: PythonNotFound