![]() Within this if statement, we’ll be checking if our integer is greater than 95. This is part of the message that we want to display on the screen. int number = 98 īelow that, declare the string message, and set it equal to "This number is ". ![]() activity_main), declare an integer number, and set it equal to 98. On a line underneath setContentView(R.layout. Then go to app > java > (topmost) > MainActivity.įirstly we have to set up some variables. To follow along with this example in Android Studio, go into Project view. ![]() If you need an introduction to coding and want to learn for FREE, check out our 30-minute beginners course here: /p/learn-to-code-in-30-minutes ![]() Specifically, we’re going to compare two ways of checking the value of an integer: using several if statements vs using one if statement. Is your code cluttered? You know what they say: tidy code, tidy mind! With this article, you’ll learn how to simplify your code. ![]()
0 Comments
Leave a Reply. |