İlgili Verileri Yapılandırmak için Structları Kullanma

Bir struct, veya yapı, birden fazla ilgili değeri bir araya getirip adlandırmanıza olanak tanıyan özel bir veri tipidir. Eğer nesne yönelimli bir dil ile tanıdıksanız, bir struct bir nesnenin veri özelliklerine benzer. Bu bölümde, struct'ları tuple'lar ile karşılaştırıp kontrast oluşturarak bildikleriniz üzerine inşa edeceğiz ve struct'ların veriyi gruplamak için ne zaman daha iyi bir yol olduğunu göstereceğiz.

We’ll demonstrate how to define and instantiate structs. We’ll discuss how to define associated functions, especially the kind of associated functions called methods, to specify behavior associated with a struct type. Structs and enums (discussed in the next chapter) are the building blocks for creating new types in your program’s domain to take full advantage of Cairo's compile-time type checking.