March 2019
Intermediate to advanced
336 pages
9h 9m
English
In this main method, we will instantiate the classes such as Table, Row, and Column, which we just took a look at. The main method creates a table and sets the name and column names. Columns are created with values. The columns are set on the rows after the rows are created. The table is printed by invoking the printTable method, as shown here:
// main methodfunc main() { var table Table = Table{} table.Name = "Customer" table.ColumnNames = []string{"Id", "Name","SSN"} var rows []Row = make([]Row,2) rows[0] = Row{} var columns1 []Column = make([]Column,3) columns1[0] = Column{1,"323"} columns1[1] = Column{1,"John Smith"} columns1[2] = Column{1,"3453223"} rows[0].Columns = columns1 rows[1] = Row{} var columns2 []Column = make([]Column,3) ...Read now
Unlock full access