For loop four elements: initial condition, cyclic condition, loop body, state change.1. for (Var a=i;i{Loop Body (example sum=sum+i sum is output)}
Examples1-20 off, not a penny.20-30 off 10 points per pass30-40 off/off 2040-49 off 30 points
1 Connection query: You can implement multiple table queries by using the Join operator.1.1 Join onSelect Name,mark from student join Mark on Student.id=mark.studentidLeft JOIN Connect-left JoinSelect Name,mark from student left join Mark on Student.
Branch statements:if (conditional statement)Syso1 ...;ElseSyso2 ...;Syso3 ...;If there is no curly brace, the function of the If,else statement is to end with the next semicolon.Loop statement:1) for (expression 1; expression 2; expression 3)
The For loop is the most complex loop structure in PHP. Its behavior is similar to the C language. The syntax for the For loop is:
for (EXPR1; expr2; expr3) statement
The first expression (EXPR1) is evaluated unconditionally once before the loop
While loopThe general form of a while loop is:while (expression) {Statement block}Where an expression is called a loop condition, a statement block is called a loop body.The while statement means that the value of the expression is evaluated first,
Using system;using system.collections.generic;using system.linq;using system.text;namespace ConsoleApplication42{ Class Program {static void Main (string[] args) {for (int i = 1; I i; x--) Console.Write (""); for (y =
More commonly used for foreach
Copy the Code code as follows:
$price =array (' Apple ' =>10, ' orange ' =>20, ' banner ' =>30);foreach ($price as $key = $value){echo $key. ' = '. $value. '';}Echo '';?>
There's a more advanced and common
C # loop statement for loop (nested while exhaustive iteration ),
For loop nesting is similar to if else
Example:Print the matrix. The outer loop corresponds to the row and the inner loop corresponds to the column.
For (int k = 1; k {For (int I = 1;
C # loop statement for loop,
Loop: execute a code segment repeatedly.
Four elements of a loop: initial condition, cyclic condition, cyclic body, and state change.For (initial condition; cyclic condition; state change){Loop body}
Given the initial
/**1. The old for statement can no longer be used. For example: for (int i=0; i2. New way: For i in 0..3. The new way of reverse for I in (0..*/Class Viewcontroller:uiviewcontroller{Override Func Viewdidload (){Super.viewdidload ()Additional setup
Looping statements are a very important part of getting started with a variety of programming languages.Here are a few exercises:A game, the first 20 off is each of its own scores, 21-30 off each off is 10 points, 31-40 off, each off is 20 points, 41
print ' x ', ' Y ' equalsprint ' x 'print ' Y 'Output x Y-------------------------------------------------------------------------------When importing a function from a module, you can1, Import Somemodule/ /import module, using function:
Conditional statements1#!/bin/Bash2 3Read-p"input your name:"name4 #第一种判断5 if["$name"=="Mike" ];then #注意这里用 [...] When comparing two strings, the variable $name quoted, and there are spaces on both sides of "= ="; "[" followed by a space; "]"
1 for statementSyntax formatFor variable in value (or loop condition)DoCommandDoneSend mail to multiple users#! /bin/bashDomain=163.comFor user in Tom Hom JemDoMail-s "Happy New Year" [email protected] $domain DoneTo print 9*9 multiplication
Tag: Extract the user under the shell and display the relevant user namePractice One:Write a script1, add 10 users user1 to User10, password with the user name, but requires only the user does not exist in the case can be added;Extension: accepts a
While loopSuitable for environments where the proposition is true when the loop is executedWhen a proposition is true, it enters a loop, and a proposition is a false exit loop.Or when the condition is met, it goes into the loop.Syntax format:While
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.