+ 5
Declaring time variables:
If I declare a variable (t = Time.new) tm = t.sec and some lines of code later tm2 = t.sec Will tm and tm2 have the same value? or not?
11 odpowiedzi
+ 8
Its yes, because the value of t doesnt change. if you do it like this:
t = Time.new
tm = t.sec
then some lines later
t = Time.new
tm2 = t.sec
theyll have different values because t gets reassigned
+ 7
No
+ 7
Please go to my profile and see my code 'a new way of promoting codes'...
Pleeeeaaasseee
+ 7
@Suoersebi3 Ohh I get it now thank you :D
+ 7
Yup :D
+ 6
Oh alright thanks @Prabhakar Pandey :D
+ 6
@Huan Wang Okay I've seen new method and I'll try to use now, thanks :D
+ 6
@Prabhakar Pandey Okay :D
+ 6
yay best
+ 3
You're welcome. So the answer is obviously yes
+ 2
When it comes to yes or no, you can just run the code and see what happens. The new method without arguments is an alias for the now method. So you know the answer...