Structures Flashcards
Checking if an item exist in the structure
Isfield(‘name of structure/name of structure.substructure’,’item to check’)
Creating Substructure in structure
‘Name of structure’.’name of substructure’.’item name’
Eg:
House.size.length=10
House.size.width=20
Variable = struct(field1,value1,struct(subfield1,subvalue1,..),..)
How to remove an item in structure
‘Name of structure’ = rmfield(‘name of structure/name of structure.name of structure’,’item to remove’)
2 methods to create structures
1: ‘name of structure’.’item in structure’ = ‘value’
Eg:
house. size = 10
house. price = 50000
2: ‘name of structure’ = struct(‘item 1’,’value of item 1’,’item 2’,’value of item 2, ….)
Eg:
House = struct(‘size’,10,’price’,50000)
How to check the value of an item in a structure
Getfield(‘name of structure/name of structure.name of substructure’,’item to check’)