Query about BREAK statement in Appinventor - Google Groups

文章推薦指數: 80 %
投票人數:10人

to MIT App Inventor Forum. How to break out of current while loop in AI2? Please help! Tim Carter's profile photo ... GroupsMITAppInventorForumConversationsLabelsAboutQueryaboutBREAKstatementinAppinventor925viewschromegeneral-questions-about-app-inventor-programminghome-networkmit-appinventor-2phonetablet-with-the-wifiwindows-7SkiptofirstunreadmessageMayankRathoreunread,Jul21,2017,3:05:37AM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetoMITAppInventorForumHowtobreakoutofcurrentwhileloopin AI2?Pleasehelp!TimCarterunread,Jul21,2017,4:30:42AM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetomitappinv...@googlegroups.comJustlikeyouwouldinanycodingsituation,setanif/thenclausewheretheloopmeetsacertainconditionseehere:https://groups.google.com/forum/#!searchin/mitappinventortest/break%7Csort:relevance/mitappinventortest/5Oq5TQFjts8/Kw5Kio7ayO8JSteveJGunread,Jul21,2017,8:44:23PM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetoMITAppInventorForumYou cannotuseaButton.Clickorothermethodtobreakoutofaloop. Tointerrupttheloop(terminatingtheloopingbeforeitselfterminates)mustbedoneprogrammably,asAIdoesn'thaveabuiltinloopbreak. SeeTim'spost andhere https://code.google.com/archive/p/app-inventor-for-android/issues/474.  Andendlessloopwillresultinaruntimeerror. ThemodelofeventprocessinginAppInventor by  Lyn  Dependingonhowyouareiterating,,insteadofasimpleloopyoucouldtryusingaClockassuggestedbyTaifun The'Dosomething'example . Youdidnotprovideanexampleofthe'looping'activity,sothatisaguess.Issue474(toprovideaBreakfunction)hasbeenonMIT's'todo'listsincelate2010...almostsevenyears. ThisisprobablyinsolvablebecauseAIexecutesasynchronously.Arunawayactivitywithinaloopwillcrashyourapp. Whattodo? Certainlyavoidlongloops(andperhapsloopsingeneral).Neverusealoopwithoutawaytoescape.Regards,SteveTaifununread,Jul21,2017,9:30:54PM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetoMITAppInventorForum@SteveJG:Scottfoundasolution,seethelinkTimposted...TaifunSteveJGunread,Jul21,2017,9:46:55PM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetoMITAppInventorForum@ThanksTaifun,. Scott'sexamples workto'terminatealoopearly'iftheloopis processingaList. Themethodswouldnotterminate Mathactivity. But,goodtoknow.Cansomethingsimilarbedonewith toterminatebeforethecounterreaches1000usingperhapsabuttonclick? TheonlysolutionIcanfindotherthanprovidinganifstatementwithintheloop..sayifcounter=200thencounter=1001 whichisasoftware'termination'  istousesomethingoncesuggestedbyABGusingaClock andthat'workssometimes".--SteveAbrahamGetzlerunread,Jul21,2017,9:57:03PM7/21/17ReplytoauthorSignintoreplytoauthorForwardSignintoforwardDeleteYoudonothavepermissiontodeletemessagesinthisgroupLinkReportmessageasabuseSignintoreportmessageasabuseShoworiginalmessageEitheremailaddressesareanonymousforthisgrouporyouneedtheviewmemberemailaddressespermissiontoviewtheoriginalmessagetoMITAppInventorForumThisisanexampleofforcedbreaksinsievebasedprimenumbersearch...http://ai2.appinventor.mit.edu/?galleryId=6477875229491200ABGReplyallReplytoauthorForward0newmessages



請為這篇文章評分?