After the initial try ruby website, I was ready to get deeper into the code language that I feel will help me to incorporate my initial learnings that I have endured thus far. I am now working on the code academy... Code Academy-great resource for many languages.. I am trying to do a lot of the RUBY as well as the Python and PhP sections that they have included on the site. I feel this will give me a foundation for things to come. I am thinking about the app that I want to build. I have a few ideas but could welcome more if they were to happen into my inbox or comments. In the reading requirement for the exercises today, I encountered some bold text words and thought it would be to my best leaning abilities if I were to jot these down for future reference if needed.
In the Ruby Language, comments are designated by #- the pound sign, a shift of the 3. A good comment in any coding language not only clarifies your code for other people, but helps to remind you of what was really going on in your mind when the code was written. # should come before your comment and it affects anything you write after that as long as you put it on a single line. Multi line comments in the Ruby language start on a single line [=begin] without the brackets, would begin your long comment and [=end] without the brackets would end your comment.
Ruby naming conventions as to not avoid confusion when you begin your transfer into the real world of coding.. the community appreciates when you start your variable names with lowercase words and separate words by underscores _ the shift of the dash.
In the Ruby language to call a method you simply do something like [deanna.length] < without the brackets, would return the number of letters in my name therefore the period before length is calling the method to do something with the string before it .
In the Ruby language you can get your input by simply typing get.
In the following code:
print "What's your last name?"
last_name = gets.chomp
last_name.capitalize!
the get statement is taking the input from the line above and storing it into the last_name variable. The chomp part of the code simply removes blank lines or spaces that would be visible in the output .
No comments:
Post a Comment