Ruby coding code example

Example 1: ruby

Ruby is python but with slightly different syntax

Example 2: ruby for programmers

irb(main):001:0> "Hello World"
=> "Hello World"

Example 3: ruby for programmers

irb(main):002:0> puts "Hello World"
Hello World
=> nil

Example 4: ruby for programmers

irb(main):007:0> a = 3 ** 2
=> 9
irb(main):008:0> b = 4 ** 2
=> 16
irb(main):009:0> Math.sqrt(a+b)
=> 5.0

Example 5: ruby for programmers

irb(main):005:0> 3**2
=> 9

Example 6: ruby for programmers

irb(main):004:0> 3*2
=> 6

Tags:

Ruby Example