RosettaCodeData/Task/Collections/Sidef/collections-4.sidef

16 lines
312 B
Plaintext

# creating a struct
struct Person {
String name,
Number age,
String sex
}
var a = Person("John Smith", 41, :man)
a.age += 1 # increment age
a.name = "Dr. #{a.name}" # update name
say a.name #=> "Dr. John Smith"
say a.age #=> 42
say a.sex #=> "man"