-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathdebugging.rb
67 lines (34 loc) · 844 Bytes
/
debugging.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
PABLO:
def get_substance(is_water)
value1 = is_water? "water":"sand"
if(is_water?)
value1 = "water"
else
value1 = "sand"
return {"substance": value1}
puts get_substance(true)
{"substance": "water"}
return {"hello": "greeting", "water": :"fluid"}
puts get_dictiorary
{"hello": "greeting", "water": :"fluid"}
def get_status(is_busy)
value = is_busy? "busy":"available"
return {"status":value}
end
get_status(false)
{"status": "available"}
puts dict["water"]
"fluid"
puts get_dictionary["water"]
PABLO END
my answer:
def get_status(is_busy)
value = is_busy ? "busy" : "available"
return {"status" => value}
end
Better Response:
def get_status(is_busy)
{"status"=>is_busy ? "busy" : "available"}
end
Differing opinions on how to write code:
most readable vs. smallest vs. most logical