Add tests for nested comprehensions

This commit is contained in:
Bruce Hill 2024-03-17 15:28:46 -04:00
parent a0faef7102
commit ccba8abf73
2 changed files with 5 additions and 0 deletions

View File

@ -57,6 +57,9 @@ if yes
>> [i*10 for i in 5 if i mod 2 != 0]
= [10, 30, 50]
>> [x for x in y if x > 1 for y in [3, 4, 5] if y < 5]
= [2, 3, 2, 3, 4]
if yes
>> arr := @[10, 20]
>> copy := arr[]

View File

@ -54,3 +54,5 @@ for k,v in t2
= {1=>10, 2=>20, 3=>30, 4=>40, 5=>50}
>> {i=>10*i for i in 5 if i mod 2 != 0}
= {1=>10, 3=>30, 5=>50}
>> {x=>10*x for x in y if x > 1 for y in [3, 4, 5] if y < 5}
= {2=>20, 3=>30, 4=>40}