label for code example
Example 1: html input label
<!-- By reference -->
<label for="first_name">First Name</label>
<input type="text" id="first_name" name="first_name">
<!-- By wrapping -->
<label>First Name
<input type="text" name="first_name">
</label>
Example 2: how to use the label tag in html
<label for="id_of_what_you're_labeling"></label>
<!-- for example-->
<label for="username"></label>
<input type="text" id="username">
Example 3: label for attribute
<label for="username">Click me</label>
<input type="text" id="username">
Example 4: label
label:
statements
Example 5: label in loop
label in loop
Example 6: for label loop
void enterEmail()
{
String Email=null;
String Choose=null;
String newName=null;
String newEmail=null;
String line="";
System.out.print("Please Enter your email:");
Email=keyboard.nextLine();
label1:
for(int i=0; i<eshop.buyersList.size(); i++)
{
if(eshop.buyersList.get(i).getEmail().equals(Email))
{
System.out.println("You logged in !!!");
System.out.println("Welcome "+eshop.buyersList.get(i).getName()+".Your personal details are: ");
eshop.buyersList.get(i).getBuyerInfo();
break;
}
else
{
System.out.println("You do not own an account in our E-shop.\n Do you wish to create a new one ?\t(Type Yes or No)");
Choose=keyboard.nextLine();
while(!(Choose.equals("Yes") || Choose.equals("No")))
{
System.out.println("Please Type in Yes or No. Anything else it's incorrect!!!");
Choose=keyboard.nextLine();
}
if(Choose.equals("Yes"))
{
System.out.println("Please enter your name:");
newName=keyboard.nextLine();
System.out.println("Please enter a new email:");
newEmail=keyboard.nextLine();
while(eshop.buyersList.contains(buyer.getEmail()))
{
System.out.println("This email is already in use.\n Please enter a new one. ");
newEmail=keyboard.nextLine();
}
Buyer buyer1=new Buyer(newName,newEmail);
eshop.addBuyer(buyer1);
break;
}
else if(Choose.equals("No")){System.out.println("\nThank you for visiting our E-Shop! =D"); System.exit(0);}
}
}
}