reverse to_f index chomp Ans: s = "abcde" print s.reverse, "\n" t = "234.32" print t.to_f + 1, "\n" u = "elephant" print u.index(3), "\n" v = "abcde\n" print v, "\n" print v.chomp, "\n"
abs size zero? to_s Ans: n = -34537 m = 2000000000000000 k = 0 print n.abs, " ", n.size, " ", n.zero?, "\n" print m.abs, " ", m.size, " ", m.zero?, "\n" print n.abs, " ", k.size, " ", k.zero?, "\n" print "*" + n.to_s + "*"
# Create a new Student object.
s = Student.new
# Save a Student object in the table.
Student.save
# Return the first record in the table.
Student.first
# Return the last record in the table.
Student.last
# Return number of rows in table.
Student.count
# Get student with id=5
s = Student.find(5)
# Get student with stud_id=4534, using dynamic finder method
s = Student.find_by_stud_id(4534)
# Get student named Bob
s = Student.find_by_first_name("Bob")
# Create and save new student
s = Student.new
s.first_name = "Patricia"
s.year = 2
s.gpa = 3.45
s.save
c = 20 f = 9 * c / 5 + 32 puts f
input = STDIN.gets c = input.chomp.to_i f = 9 * c / 5 + 32 puts f
r = 17 % 3 print r, "\n"