VS code is a development IDE. You have 3 options:
Web IDE: vscode.dev
Local Macbook IDE: link
Local Windows IDE: link
Install Ruby LSP
Install code runner: control-command x. Code runner, install
Enable running code in terminal:
- Open “Code->Preferences->Settings.
- Type “code runner” in search bar at top
- Scroll down to “Code-runner: Run In Terminal”
- Enable
Create a new file “area.rb”. Put in:
=begin
Ruby program to find Area of Rectangle.
=end
# input length and breadth, and
# convert them to float value
puts "Enter length:"
l=gets.chomp.to_f
puts "Enter width:"
w=gets.chomp.to_f
# calculating area
area=l*w
# printing the result
puts "Area of Rectangle is #{area}"
Right click on code and select “Run Code”
Select “TERMINAL” tab, and click in terminal and enter data into program.
