+ 13

Ruby gives us many options and choices, can it be too much ???

e.g puts, print, p, ', ", putc etc. Try this : nl means new line puts "'''" ''' + nl puts '"""' """ + nl print "'''" ''' without nl print '"""' """ without nl puts nl only p "'''" ''' in double quotes + nl p '"""' \"\"\" in double quotes changed from single quotes + nl p '' only double quotes changed from single quotes + nl p expected nl but nothing, probably it's variable p, not a method p putc "'''" ' first char only without nl putc '"""' " first char only without nl But it's difficult to learn all of this nuances!!! Sometimes, I've a big mish-mash!!!

6th Sep 2017, 1:14 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
9 ответов
+ 5
too much true but usage will make you learn it after you are at ease with the core, you'll like very much the extra !
6th Sep 2017, 3:48 PM
Abdur-Rahmaan Janhangeer
Abdur-Rahmaan Janhangeer - avatar
+ 7
You don't need to learn every single method which do the same thing and about p, puts, print these are different from each other !
6th Sep 2017, 1:17 PM
Ekansh
+ 6
there's a choice you are not needed to learn them all. choose the one you want to use we have a choice!!!
6th Sep 2017, 1:20 PM
Lord Krishna
Lord Krishna - avatar
+ 6
But, if you want to make the best choice, you need to know every single method, in other case, you can lose the best way. So, you should know all options, variants, differences & nuances. Programming isn't easy. Good coding is hard!!!
6th Sep 2017, 1:54 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar
+ 6
@krishns p is less well known than print and puts . It is similar to puts in that it adds a newline, but rather than calling to_s , p calls inspect 
6th Sep 2017, 1:57 PM
Ekansh
+ 5
yes agree! I think it's 2 much...
6th Sep 2017, 12:45 PM
AL.The.Flame!
AL.The.Flame! - avatar
+ 5
ekansh isn't p a shortcut to puts ? I like using p instead of print or puts
6th Sep 2017, 1:19 PM
Lord Krishna
Lord Krishna - avatar
+ 5
@Janusz i came to know about it from comments section i assumed it was a shorthand for puts. thanks @Ekansh
6th Sep 2017, 2:55 PM
Lord Krishna
Lord Krishna - avatar
+ 4
SoloLearn doesn't mention about p method. I've known about it from our community.
6th Sep 2017, 2:17 PM
Janusz Bujak 🇵🇱 🇺🇦
Janusz Bujak 🇵🇱 🇺🇦 - avatar