Use the loop and array to reduce the coding

in android studio i use code below(ie):

for (i=0;i,5;i++){
textView[i].setVisibility(INVISIBLE);
}
instead of:

textView1.setVisibility(INVISIBLE);
textView2.setVisibility(INVISIBLE);
textView3.setVisibility(INVISIBLE);
textView4.setVisibility(INVISIBLE);
textView5.setVisibility(INVISIBLE);

and Mywork gets easier and the number of codes gets lower .in appinventor Can I use the same code?use of loop and array together.

Sure. In Ai2 use the Any blocks and generic blocks.
Sample projects ...

1 Like

ok.thanks.very interest.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.