all: updateimport () and []array

This commit is contained in:
yuyi 2020-04-26 19:49:31 +08:00 committed by GitHub
parent 7b39ab6d06
commit 9f4d498ff1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
59 changed files with 181 additions and 254 deletions

View file

@ -22,7 +22,7 @@ fn main() {
m[word] = m[word] + 1 // TODO m[key]++
}
// Sort the keys
mut keys := m.keys()
mut keys := m.keys()
keys.sort()
// Print the map
for key in keys {
@ -33,7 +33,7 @@ fn main() {
// Creates an array of words from a given string
fn extract_words(contents string) []string {
mut splitted := []string
mut splitted := []string{}
for space_splitted in contents.to_lower().split(' ') {
if space_splitted.contains('\n') {
splitted << space_splitted.split('\n')
@ -43,7 +43,7 @@ fn extract_words(contents string) []string {
}
}
mut results := []string
mut results := []string{}
for s in splitted {
result := filter_word(s)
if result == '' {