0% found this document useful (0 votes)
48 views9 pages

Programming in Go Class Test 2-2

The document appears to be a collection of notes or instructions related to programming in Go, including topics like type assertion, function execution, and switch statements. It includes code snippets and explanations of concepts such as dynamic typing and interface handling. Additionally, there are references to error handling and method modifications.

Uploaded by

sahanirutik93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
48 views9 pages

Programming in Go Class Test 2-2

The document appears to be a collection of notes or instructions related to programming in Go, including topics like type assertion, function execution, and switch statements. It includes code snippets and explanations of concepts such as dynamic typing and interface handling. Additionally, there are references to error handling and method modifications.

Uploaded by

sahanirutik93
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
hon\ (Ty BCA CSO), LOW CRAFT STICKER | > Paste the Barcode Sticker here 1 L s ; arene tebe yerar Tao Hunsved § fireroabdy wan ew ey rete feet ert Tweney Two |e Vere fo trac the ftw whee seca aft | aes unt | } | |g) ereaite fear error firrean carters eft wy ear | feecera vy) ered en ar Fee areata ht ‘rearerfer wanre area ete _Atlo3lz025 “English Supplements attached _ Hissa No.02, Court Road, ghar (W)-401 404 No QNe o> Whot iS ne Correce Way +o dedlare a s\iee An Go 2 > o> Var a Ciint = CJint £1.2535 b>) What is the purpose of tne deter keyword un Go? 4 >A) To delay the execurion of 0 function suntil the Surrounding Funcrion returns. oc) \S a dwecrorxy side the fo workspace Concainimna one ov more Go Source fies = wins Mi — >_> package Log ee A) iropore “sevings” is Known as 0 > 182 BAR AAS tras ( dood dt) sete a ed| \e_ afunctxian thar tests a Specaikic piece of code £yom a progyom Sy _ spackage. ie eee ee tee S oN > _p) Unix tes = omlQ 2] iy o iMugenare tthe $i apse Oa CS String Be a, DWAPWinagolang + AP concep of embeddrna, \oxrer fac — 51, > package main af _impore fm" | i Pe a a +3 type wrirer Wreveace al ii —}+_ write ©) string lac BP lass ; ae ki —__ type Aurhor interface A =~. te wwrer r ; ae abd 4: eee a ai +yp2 Book Stuce al i ok pee seieie erying te m at eee a ee - — Ma Func moin (1 2 i - Vara Author = Book {Go programmi? = _ Fmt. printin Ca. write ©) | Amt. prine\nCa-Read ©) zy ae 4 —- 2WExplain Type [Link] example? — 7 Type asserxion inca is used +0 veeyere Lthe dynamic value Stered on an Inverface Janda Convey j< tO Speci fe-type: MOTs helps when we have a varia»\e of an interface {t typeiand need +o Cxtyacte 1S actual type uy Se WOSy nxax :- _ Value, ok |= interface _variavle Crarget Type) Fox £x ie package malo impoye “Ema” Func main 12 £ Vax i interface {5 =“Wello, Gort litgpe assertion to String Str, ok = i{Sx sing) \f OK _— Lib tid, Fmt printin (“ String." Sex ia is es yielse = _ Fmtprintin C'Type assevxion failed") Package man Impowe Sfmt.” ~_—L. bype Astnor Stra ce a mame sixing — — book Wwe Ri Ale Oceans is ai Func Ca Pocinar) Eo CoS Et. prinvin (Author =" % ay. a Fe prinain Co Book published +) 0P ook) 8 — rm + ——_—— | Punt wnoin Cot) 4+ Co ies QL -= Author 1“ Rober Maeeee sa. BAS FE SSO) ae 2 = Aecats Ba ae Receiver -% [on paise Person {Alice Smt. Prinxin (iBe-sre updates > > > Pa. espe nice sade Bob Pa named , Fmt printin CAF &xe™ update +) fete Lol sticge — EDN on oo Sy Beth nts! BN 2. Ltt d >_ Package main impore “fmt = | Fae os SCS ei “ch: = make Cchan sting, ou ch <= “Werno”? t z \ ch <= Go" pe oe Belong = eS ee ea ME cases 0): oH) 4 os bluataegaenll Str pine oe Cy) = Smt printin Cé-th) _ ati : a v3 :-B) ry sl agpe Swit ch in Go s- A type suitch is a {SPecial kina of Switon Statement +node jObows Us to determine the dAgnomic ype fan Inter FACE Valve ar santdme fae \s useful woken dealing with empry poterfaces ( unrerFo ce {4 ) thas Can tno id jMalwes of any. type {9 Syntax) = {_Bwitch vit 2 Cryped & }— Case in | {__fnse Styving? _ + ewe a is ail a Precey sex = Be —+ Package main — — Sa ewan ee ae ne Rene. co ee Lt)VL Sustechh_v 51. Cxype ) 2 oe ee oo ee $$$ $$$ Prins ic Tee 1 iN) ae

You might also like