Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Standalone return expression explanation

Tags:

android

I was online looking at some android coding examples and i came across a method that had a return expression by itself,and i was wondering if someone could explain what that means.

Here is the code sample:

if(tempText.getText().length() ==0){

    Toast.makeText(this, "Please enter a valid number", Toast.LENGTH_LONG).show();

     return;
 }
like image 960
Troy Barrios Avatar asked Jul 11 '26 13:07

Troy Barrios


1 Answers

This is the If condition which checks for the length of the text which is "0" or not. If its "0" then it will show the Toast message and will return from or exit from the if loop an no further execution will processed.

like image 130
GrIsHu Avatar answered Jul 14 '26 02:07

GrIsHu



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!