1
0
mirror of https://github.com/adambard/learnxinyminutes-docs.git synced 2025-08-30 10:00:26 +02:00

Merge branch 'master' into julia1

This commit is contained in:
Adam Bard
2018-08-22 19:48:46 -07:00
committed by GitHub
2 changed files with 6 additions and 5 deletions

View File

@@ -501,9 +501,10 @@ add_10(3) # => 13
map(add_10, [1,2,3]) # => [11, 12, 13]
filter(x -> x > 5, [3, 4, 5, 6, 7]) # => [6, 7]
# We can use list comprehensions for nicer maps
[add_10(i) for i = [1, 2, 3]] # => [11, 12, 13]
[add_10(i) for i in [1, 2, 3]] # => [11, 12, 13]
# We can use list comprehensions
[add_10(i) for i = [1, 2, 3]] # => [11, 12, 13]
[add_10(i) for i in [1, 2, 3]] # => [11, 12, 13]
[x for x in [3, 4, 5, 6, 7] if x > 5] # => [6, 7]
####################################################
## 5. Types