Some programs in debugging, compatibility, platform porting and so on may want to create a different software by simply setting some parameters, this can of course, through the variable settings, all the code can be used to write in the
1. While loopContact Code: M=0#defines the value of m as 0Print('before the cycle begins m=%s'%m) whileRange (10): M+=1#value of +1 per cycle m Print("The first%s loop, at which time m=%s"%(M, m))ifm%2==0:Print(m)ifM >=10: Print('begin to
Preprocessor commands are very powerful and are used extensively during programming, such as easy to use in version release, 1, #define (tells the compiler that there is a symbol for the given name) #undefine (delete symbol) 2,
Conditional judgment can be divided into:Single-branch judgment: only one if statementTwo-branch judgment: if Else's formatMulti-Branch judgment: if elif else formatConditional statement nesting judgment#Here's a conditional multi-branch judgment
In the shell of Linux
The IF statement determines which branch to execute through the relational operator to determine the true or false of an expression. The Shell has three kinds of if ... else statements:
If ... fi statement;
if ... else .
Print their permissions based on user input # alex--Super Admin # Eric--General manager # Tony,rain-- Business Supervisor # Other--Ordinary usersName = input (' Please enter your name ') if name = = ' Alex ': print (' Super admin ') elif
1. # define and # UNDEF define or cancel defining condition compilation symbols
2. # If, # Elif, # else and # endif are used to skip based on conditions.Source codeSection
3. # ifdef, # ifndef determine whether the symbol is defined
4. # error,
Let's say the following code is required to be compatible with three versionsThis will not complete the task.No mattertypedef enum{first,second,third,}; #define NUM third#if (num = = first) #define VAR 1#elif (num = = SECOND) # Define var
First, the process branch 1. Single branch: Example 1: Establish a judgment, enter age, determine whether the age is greater than 23, if greater than 23, print the result: ' It is time to find a bf ':1 age_of _you=int (Input ('please input your name:
Some programs are debugging, compatibility, in situations like platform porting, you might want to generate a different software by simply setting some parameters, which, of course, can be done with variable settings, write all the possible code,
Original articles, reproduced please indicate the source, thank you.Author: Qing Lin, blog name: Flying Air and static crossing
#if语句
#if语句会计算它后面的表达式, and checks the result of the expression, if the result is true (true), the subsequent statement
Reprint: http://blog.chinaunix.net/uid-26854432-id-3181585.html #if语句
#if语句会计算它后面的表达式, and checks the result of the expression, if the result is true (true), the subsequent statement is compiled, and if False (false), the subsequent statement is
This article describes in detail three options in Python: If statements, if/else statements, and if/Elif/else statements. For each statement, we provide the corresponding flowchart. At the same time, we provide many simple sample programs to help
When programming, you often need to check a set of conditions and decide what action to take accordingly. In Python, the IF statement allows us to examine the current state of the program and take appropriate action accordingly.
5.1 A simple
When programming, you often need to check a series of conditions and decide what measures to take accordingly. In Python, the if statement enables us to check the current state of the program and take corresponding measures accordingly. 5.1 The
I. Overview of the ContentThis article mainly introduces the pre-compiling directives related to conditional compilation in C language, including # define, #undef, #ifdef, #ifndef, #if, #elif, #else, #endif, defined.Second, conditional
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.