Blocks for Transactions Discussed (Part 1)

The sample code above shows the number of techniques that can be used to maximize the use of blocks for transactional control where the takeAndDosomething method is considered a class method and that it can be called independent or without influence of any single File Object. We used it to function in the same manner as the File.open method without consideration of any arguments. We called the File.open method, passed onto it the transaction or condition which was defined in the *args as a parameter. Shortening it all, the “openAndDosomething” transparently passes whatever conditions or parameters it gets towards the File.open method. Once the file ios open and the “openAndDosomething” calls on the yield statement passing the opened file to the block/chunk of code.

This entry was posted in Development, Programming Basics, Programming Language and tagged , . Bookmark the permalink. Comments are closed, but you can leave a trackback: Trackback URL.