added Magazine Subscribers
This commit is contained in:
		
							
								
								
									
										22
									
								
								playground/magazineSubscribers.go
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										22
									
								
								playground/magazineSubscribers.go
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,22 @@
 | 
				
			|||||||
 | 
					// from chapter 8 of head first go
 | 
				
			||||||
 | 
					package main
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import "fmt"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					type subscriberType struct {
 | 
				
			||||||
 | 
						name   string
 | 
				
			||||||
 | 
						rate   float64
 | 
				
			||||||
 | 
						active bool
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					func magazineSubscribers() {
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						var subscriber subscriberType
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						subscriber.name = "Aman Singh"
 | 
				
			||||||
 | 
						subscriber.rate = 4.99
 | 
				
			||||||
 | 
						subscriber.active = true
 | 
				
			||||||
 | 
						fmt.Println("Name:", subscriber.name)
 | 
				
			||||||
 | 
						fmt.Println("Monthly rate:", subscriber.rate)
 | 
				
			||||||
 | 
						fmt.Println("Active?:", subscriber.active)
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
		Reference in New Issue
	
	Block a user