Thursday 5 December 2013

Learn Ruby Language and Be an exploit coder-2




Comments And Pound Characters.


So hows u guyz? hope u'll be fine . Lets move to our next practice.
Comments are very important in your programs. They are used to tell you what something does in English, and they also are used to disable parts of your program if you need to remove them temporarily. Here's how you use comments in Ruby:

  • # A comment, this is so you can read your program later.
  • # Anything after the # is ignored by Ruby.

  • puts "I could have code like this." # and the comment after is ignored

  • # You can also use a comment to "disable" or comment out a piece of code:
  • # puts "This won't run."

  • puts "This will run."

What You Should See:

  • $ ruby exploit2.rb
  • I could have code like this.
  • This will run.
  • $

Extra Credit

Find out if you were right about what the # character does and make sure you know what it's called (octothorpe or pound character).
Take your exploit2.rb file and review each line going backwards. Start at the last line, and check each word in reverse against what you should have typed.
Did you find more mistakes? Fix them.
Read what you typed above out loud, including saying each character by its name. Did you find more mistakes? Fix them.

No comments:

Post a Comment