Second part describes the main moments in ruby. Some interesting things.
Anybody know how to use %q and %Q. But what is the difference. %Q - creates double quotes and %q creates single quotes.
That is the difference from rescue and raise
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin | |
a = b / 0 | |
rescue ZeroDivisionError | |
puts (‘Fatal error’) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if b == 0 | |
raise ZeroDivisiobError | |
end | |
return a /b |
require ‘account.rb’ - you can use class from account.rb like it is described in the same file.
Comments
Post a Comment