GeekNationgeeknation.joshisfitness.com·Jan 27, 2024CrystalLang-BlocksA block is the same thing as a method, but it does not belong to an object. Blocks are called closures in other programming languages. There are some important points about Blocks in crystal: Block can accept arguments and returns a value. ...crystal
GeekNationgeeknation.joshisfitness.com·Jan 13, 2024CrystalLang-Initialize MethodThe initialize method is useful when we want to initialize some class variables at the time of object creation. The initialize method is part of the object-creation process in Crystal and it allows us to set the initial values for an object. Below ar...crystal
GeekNationgeeknation.joshisfitness.com·Jan 4, 2024CrystalLang-IteratorsThe word iterate means doing one thing multiple times and that is what iterators do. Sometimes iterators are termed as the custom loops. “Iterators” is the object-oriented concept in crystal. In more simple words, iterators are the methods w...crystal
GeekNationgeeknation.joshisfitness.com·Dec 28, 2023CrystalLang-Static MembersIn crystal lang, static members are known as class variables. These variables are shared among all instances of a class and are declared using the @@ symbol. Class variables retain their value across different instances of the class and can be access...crystal
GeekNationgeeknation.joshisfitness.com·Dec 26, 2023CrystalLang-LambdaIn CrystalLang, a lambda is a type of anonymous function or a block of code that can be assigned to a variable or used inline. It encapsulates control flow, parameters, and local variables into a single package. lambda_variable = ->(param) { p...crystal
GeekNationgeeknation.joshisfitness.com·Dec 24, 2023CrystalLang-PolymorphismIn Crystal, one does not have anything like the variable types as there is in other programming languages. Every variable is an “object” which can be individually modified. One can easily add methods and functions on every object. So here, the Object...crystal
GeekNationgeeknation.joshisfitness.com·Dec 23, 2023CrystalLang-EncapsulationEncapsulation is defined as the wrapping up of data under a single unit. It is the mechanism that binds together code and the data it manipulates. In a different way, encapsulation is a protective shield that prevents the data from being accessed by ...crystal
Yacine Petitprezanykeyh.hashnode.dev·Feb 11, 20213 years of Crystal Lang programming: The good, the bad, the uglyEDIT: It's now 1.5 years since I wrote this post, and I forgot to update it: most of the problems discussed below are gone! The application is compiling and running smoothly in ---release mode. The customer is still happy, everything is working perfe...9 likes·1.7K readslanguages