-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathapp.rb
88 lines (53 loc) · 1.34 KB
/
app.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
# strings
# puts 'Hello World'
# puts 'Hello World'
# puts 'Hello World'
# print 'Hello World'
# print 'Hello World'
# arrays
# puts [1, 2, 3].inspect #inspect method
p [1, 2, 3]
pp [{ id: 1, hello: "World" }, { id: 2, hello: "Ruby" }, { id: 3, hello: "Moon" }, { id: 4, hello: "Learner" }]
# user_name = "John"
# age = 30
# gpa = 3.4
# # concatenation
# # puts ("Hello " + user_name + " I understand you've turned " + age + " today")
# puts "Hello #{user_name} you're #{age} years old yet you've attained a gpa of #{gpa}"
# # data types include
# # string, number, floating point numbers/decimals, boolean, nil(null in JS)
# # strings && methods
# animal = 'Fox'
# sentence = "I love #{animal}"
# puts sentence
# # ruby string methods
# puts animal.upcase()
# puts animal.downcase()
# puts animal.strip()
# puts animal.length()
# # boolean
# puts animal.include? "ox"
# puts animal.include? "3"
# array
# puts animal[2] #index
# puts animal[0,2] # range index
# print 'hello'; puts 'world';
# comments
# this is an inline comment
=begin
this is a
multiline
comment
=end
# puts "This is main Ruby Program"
# # code is called after program runs
# END {
# puts "Terminating Ruby Program"
# }
# # code is called before program runs
# BEGIN {
# puts "Initializing Ruby Program"
# }
# 16/10/2022
# num1 = 12
# puts num1