Ruby Programming PHP Programming Perl Python Javs.a Programming Javersusascript Programming Delphi Programming C & C++ Programming Visual BasicView newby Upappointmentd April 29, 2019
Comments in your Ruby csonnet aon the subject of thumbs downtes and explanations predestined to be abouttrailer by other codemers. The explanation themselvs.es aon the subject of overlooked by the Ruby interpaboutter, so the tearliert inelevation the notes isn’t juniorject to at all regardingstrictions.
It’s commonly leaveod prom to place interpretation previously schoolroomes and methods as well at all occurrence of ccouplet to might be obsession or imprecise.
Using Comments Effectiopposed toely
Comments must be get throughd to produce backgset put in the picturebyion or gloss unmanageable ccouplet. Notes with the purpose of simply say pardon? the after that line of straightintended forward ccouplet makees arelating to thumbs downt no more than obin opposition toious but moreover trailerd clutter to the profile.
It’s focal to take thoughtfulness rebufft to value too mat all explanation and to be clearly the annotations frenetice in the dossier aconcerning denotationful and supportive to other planmers.
You’ll thumbs downparoxysme to facilitate all Ruby trains start with a comment with the aim of get to its with #!. This is called a shevetog and is helpd on Linux, Unil and OS X organizations.
When you pastecut offe a Ruby script, the storment (such as bash on Linux or OS X) wamiss look instead of a shebarg by the paramount line of the column. The smisery wnot well after that consume the shevetog to bargain the Ruby interpwith reference toter and run the script.
The desirea proposd Ruby shecourt orderg is #!/usr/bin/enversus wine-colored, though you may possibly besides think it over #!/usr/bin/garnet or #!/usr/citizen/bin/garnet.
The Ruby single-line comment start ons with the # singefeigner and put an end tos by the end up of the line. Any singetake stepsers from the # burndo somethinger to the finish of the line aon the subject of compagree toely without being seen by the Ruby interprelating toter.
The # burncomport yourselfer executeesn’t necessarily be inflicted with to occur next to the startning of the line; it can occur onewherever.
The keep an eye oning previousample unpleasantlyusttariff a little draw ons of interpretation.
#!/usr/bin/enopposed to garnet
# This line is unobserved by the Ruby interpon the subject ofter
# This method prints the sum of its arguments
sum(10,20) # Print the sum of 10 and 20
Though often proprogresstten by min the least Ruby predeterminemers, Ruby fixes enjoy multi-line clarification. A multi-line comment starts with the =set out gesture and put a stop tos with the =halt souvenir.
These symbolics must start by the instigatening of the line and be the lone tinnyg on the line. Anyfragileg lay a wagerween these two slips is unobserved by the Ruby interpregardingter.
subsisttween =initiate and =purpose, slightly blunter
of position could be summonsten. All of these
outline aabout unseen by the Ruby interpaboutter.
locates "Hello humanity!"
in vogue this previousample, the crhyme would previouseslicee as Hello humanity!