dse:data_query_for_loop
Ceci est une ancienne révision du document !
Table des matières
DSE / Data Query / For Loop
Itération sur 2 tableaux de manière synchronisée
tableau1:List<String>=["A", "B", "C", "D"];
tableau2:List<String>=["value A", "value B", "value C", "value D"];
fusion:List<String>=List.range(startInclusive: 0, endExclusive: tableau1.length, step: 1 )
.map(index => tableau1[index] + "="+ tableau2[index]);
Résultat
["A=value A","B=value B","C=value C","D=value D"]
Créer d'une matrice croisant 2 chaines de caractère
term1:String="chien";
term2:String="niche";
matrix:List<List<String>>= List.range(0,term1.length)
.map(index1 => List.range(0,term2.length)
.map(index2 => term1.charAt(index1) + "-" + term2.charAt(index2)
)
) ;
Résultat
[["c-n","c-i","c-c","c-h","c-e"],["h-n","h-i","h-c","h-h","h-e"],["i-n","i-i","i-c","i-h","i-e"],["e-n","e-i","e-c","e-h","e-e"],["n-n","n-i","n-c","n-h","n-e"]]
dse/data_query_for_loop.1716927351.txt.gz · Dernière modification : (modification externe)
