/
githubmirror
/
sway
Обзор
Документация
Войти
/
githubmirror
/
sway
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/tuples/src/main.sw
25 строк
662 B
Sophie Dankel
ci: fixing typos programmatically (#5975)
09 май 2024, 03:21
Не верифицирован
09 май 2024, 03:21
f8e8d35
Код
Авторство
О чём код?
library; fn tuple() { // You can declare the types yourself let tuple1: (u8, bool, u64) = (100, false, 10000); // Or have the types be inferred let mut tuple2 = (5, true, ("Sway", 8)); // Retrieve values from tuples let number = tuple1.0; let sway = tuple2.2.1; // Destructure the values from the tuple into variables let (n1, truthness, n2) = tuple1; // If you do not care about specific values then use "_" let (_, truthness, _) = tuple2; // Internally mutate the tuple tuple2.1 = false; // Or change the values all at once (must keep the same data types) tuple2 = (9, false, ("Fuel", 99)); }