What's going on, Swift will create it and generate our Main.swift file:
See Hello World, then control the statement in Swift what is the appearance of something, and see:
Import Foundationprint ("Hello, world!.")//Define a scorevar score = the//Define a numbervar Scorearr = [ -, -, -, -, -, -]var Minscore=0; var maxscore=0; var avgscore=0.0var sumscore=0.0var count=Scorearr.count;//loop all the elements forSinchscorearr{Sumscore= Sumscore +Double (s) print ("S is \ (s)") if(Minscore = =0|| Minscore >s) {Minscore=s}Else if(Maxscore = =0|| Maxscore <s) {Maxscore=s}} Avgscore= Sumscore/Double (count);p rint ("Sumscore is \ (sumscore) Avgscore is \ (avgscore)") Print ("Max score is \ (maxscore) min score is\ (minscore)") for(Var i=0; i<count;i++) {var s=Scorearr[i]; Print ("For : i \ (i) s = \ (s)") if(Minscore = =0|| Minscore >s) {Minscore=s}Else if(Maxscore = =0|| Maxscore <s) {Maxscore=s}} Avgscore= Sumscore/Double (count);p rint ("Sumscore is \ (sumscore) Avgscore is \ (avgscore)") Print ("Max score is \ (maxscore) min score is\ (minscore)") var index=0; repeat{if(Index >=count) { Break;//Exit} var s=Scorearr[index]; Print ("Do While s[\ (index)]=\ (s)");} while(++index <count); index=0; while(Index <count) {var s= Scorearr[index];//get the first element of IPrint"Do While s[\ (index++)]=\ (s)");}//the switch before switch will pierce through the following executionLet Apptype ="IOS"Switchapptype{ Case "IOS": Print ("IOS") Fallthrough;//go down and penetrate a layer Case "AD": Print ("AD") Case "WP": Print ("WP") default: Print ("No matching values")}
Summary: Later perfect ...
Swift Base _ Control statement