Merge pull request #291 from kimshrier/exercise_098_typo

Improve wording in some comments
pull/2/head
Chris Boesch 1 year ago committed by GitHub
commit 94f52b9298

@ -39,7 +39,7 @@ fn isPangram(str: []const u8) bool {
// first we check if the string has at least 26 characters // first we check if the string has at least 26 characters
if (str.len < 26) return false; if (str.len < 26) return false;
// we uses a 32 bit variable of which we need 26 bit // we uses a 32 bit variable of which we need 26 bits
var bits: u32 = 0; var bits: u32 = 0;
// loop about all characters in the string // loop about all characters in the string
@ -50,8 +50,8 @@ fn isPangram(str: []const u8) bool {
// //
// to do this, we use a little trick: // to do this, we use a little trick:
// since the letters in the ASCI table start at 65 // since the letters in the ASCI table start at 65
// and are numbered by, we simply subtract the first // and are numbered sequentially, we simply subtract the
// letter (in this case the 'a') from the character // first letter (in this case the 'a') from the character
// found, and thus get the position of the desired bit // found, and thus get the position of the desired bit
bits |= @as(u32, 1) << @truncate(u5, ascii.toLower(c) - 'a'); bits |= @as(u32, 1) << @truncate(u5, ascii.toLower(c) - 'a');
} }

Loading…
Cancel
Save