RosettaCodeData/Task/Collections/Sidef/collections-4.sidef
2016-12-05 23:44:36 +01:00

15 lines
312 B
Text

# 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"