From 2680987cd4cc9ccd01aaaf99fb45bf99e6411d62 Mon Sep 17 00:00:00 2001 From: jagapoga <32883850+rjpgt@users.noreply.github.com> Date: Wed, 3 Jan 2024 23:02:58 +0530 Subject: [PATCH] Update introduction.md for language corrections for the library-of-luton exercise (#571) --- .../library-of-luton/.docs/introduction.md | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/exercises/concept/library-of-luton/.docs/introduction.md b/exercises/concept/library-of-luton/.docs/introduction.md index c5bc5605..ada6d73a 100644 --- a/exercises/concept/library-of-luton/.docs/introduction.md +++ b/exercises/concept/library-of-luton/.docs/introduction.md @@ -1,7 +1,7 @@ # Char `Char` is a data type in Crystal that represents a 32-bit [Unicode][unicode] code point. -Their size makes so they are memory efficient, and also gives it certain properties that Strings don't have. +Their size makes them memory efficient, and also gives them certain properties that Strings don't have. They are created using single quotes (`'`) and do only allow for one Unicode code point to be placed inside. ```crystal @@ -9,12 +9,12 @@ They are created using single quotes (`'`) and do only allow for one Unicode cod 'a'.class # => Char ``` -When working with Strings in Crystal is it quite common to work with Chars, since quite a few methods in the String class return Chars or takes Chars as arguments. -For example, the [`String#[]`][index] method returns a Char, or the [`String#chars`][chars] method returns a collection of Chars. +When working with Strings in Crystal it is quite common to work with Chars, since quite a few methods in the String class return Chars or takes Chars as arguments. +For example, the [`String#[]`][index] method returns a Char, and the [`String#chars`][chars] method returns a collection of Chars. ## Incrementing / Decrementing -Due to char being a 32 Unicode point do they support incrementing and decrementing, this makes it so if you have `'a'` so can you get `'b'` by adding one. +Due to Char being a 32 Unicode point it supports incrementing and decrementing. For example, if you have `'a'` you can get `'b'` by adding one. ```crystal 'a' + 5 @@ -36,8 +36,8 @@ There is also a method called [`Char#succ`][succ] which will return the next cha ## concatenation -Since Chars is only meant to represent a 32-bit Unicode, can't 2 chars be concatenation. -Thereby Chars can only be concatenated with Strings. +Since a Char is only meant to represent a single 32-bit Unicode point, concatenation of 2 Chars is not allowed. +Chars can only be concatenated with Strings. ```Crystal 'a' + "bc" @@ -47,7 +47,7 @@ Thereby Chars can only be concatenated with Strings. # => error: expected argument #1 to 'Char#+' to be Int or String, not Char ``` -## Properties methods +## Properties, methods Crystal has a few methods that can be used to get information about a Char, like if it is a number or a letter, or if it is uppercase or lowercase. Here is a list of some of the methods, for a full list see the [Char API][char-api]: @@ -65,7 +65,7 @@ Here is a list of some of the methods, for a full list see the [Char API][char-a ### Converting between code points and Chars -Since Chars is a 32-bit Unicode point, so can you convert between Chars and code points (Int). +Since Chars is a 32-bit Unicode point, you can convert between Chars and code points (Int). This can be done using the [`Char#ord`][ord] method which will return the code point of the Char, or the [`Int#chr`][chr] method which will return the Char of the code point. ```crystal @@ -78,8 +78,8 @@ This can be done using the [`Char#ord`][ord] method which will return the code p ### Converting between types -As with other data types so does Chars have a few methods that can be used to convert between types. -The most common one is the `Char#to_s` method which will convert the Char to a String, but there is also the `Char#to_i` method which will convert the Char to an Int, And the `Char#to_f` method which will convert the Char to a Float. +As with other data types, Chars have a few methods that can be used to convert between types. +The most common one is the `Char#to_s` method which will convert the Char to a String. There is also the `Char#to_i` method which will convert the Char to an Int, and the `Char#to_f` method which will convert the Char to a Float. ```crystal 'a'.to_s