GVKun编程网logo

WordPress 判断语句(wordpress判断用户是否已经登陆)

3

在这篇文章中,我们将为您详细介绍WordPress判断语句的内容,并且讨论关于wordpress判断用户是否已经登陆的相关问题。此外,我们还会涉及一些关于c语言入门教程–-5判断语句、C#-判断语句、

在这篇文章中,我们将为您详细介绍WordPress 判断语句的内容,并且讨论关于wordpress判断用户是否已经登陆的相关问题。此外,我们还会涉及一些关于c 语言入门教程–-5 判断语句、C#- 判断语句、C#-判断语句(五)、C++判断语句的知识,以帮助您更全面地了解这个主题。

本文目录一览:

WordPress 判断语句(wordpress判断用户是否已经登陆)

WordPress 判断语句(wordpress判断用户是否已经登陆)

  • 介绍

在 WordPress 中有很多判断语句,例如:是否为首页、是否为文章页面等等。本文对这些判断语句做了一些总结。

is_home()

is_single()

is_page()

is_category()

is_auth()

is_tag()

is_date()

is_year()

is_month()

is_day()

is_time()

is_archive()

is_search()

is_404()

is_paged()

查看原文:http://surenpi.com/2016/01/20/wordpress%e5%88%a4%e6%96%ad%e8%af%ad%e5%8f%a5/

c 语言入门教程–-5 判断语句

c 语言入门教程–-5 判断语句

OSC 请你来轰趴啦!1028 苏州源创会,一起寻宝 AI 时代

转:

c 语言入门教程–-5 判断语句

c语言入门教程–-5判断语句

#include
       
       

        
        int main() { int a=1; int b=1; if(a==b) { printf("相等"); } else { printf("不相等"); } return 0; }
       
       

转:

c 语言入门教程–-5 判断语句


--Posted from Rpc

C#- 判断语句

C#- 判断语句

 C#- 判断语句

语句 描述
if if 语句加 bool 表达式
if...else if 语句加可选的 else 语句,else 语句在布尔表达式为假时执行。
switch 一个 switch 语句允许测试一个变量等于多个值时的情况。
?: 三目运算符,等效于 if...else

题目 1:判断一名学生的考试成绩是优秀(85-100),良好(70-84),及格(60-69),不及格为 60 分以下,得分没有半分的概念。

class Program
    {
        static void Main(string[] args)
        {
            int score = 65;
            if (score >= 85)
            {
                Console.WriteLine("优秀");
            }
            if (score>=70 && score<=84)
            {
                Console.WriteLine("良好");
            }
            if (score >= 60 && score <= 69)
            {
                Console.WriteLine("及格");
            }
            if (score < 60)
            {
                Console.WriteLine("不及格");
            }
            Console.ReadKey();

        }
    }
class Program
    {
        static void Main(string[] args)
        {
            int score = 85;
            if (score >= 85)
            {
                Console.WriteLine("优秀");
            }
            else if (score>=70)
            {
                Console.WriteLine("良好");
            }
            else if (score >= 60)
            {
                Console.WriteLine("及格");
            }
            else
            {
                Console.WriteLine("不及格");
            }
            
            Console.ReadKey();
        }
    }

上面有两组代码,明显是第二组代码比第一组优秀,不仅仅是层次结构更加优秀,并且减少了判断此数,提升了程序性能。

题目 2:判断月份的天数?不考虑闰年,2 月假定 28 天。

static void Main(string[] args)
        {
            byte month = 2;
            switch (month)
            {
                case 1:
                case 3:
                case 5:
                case 7:
                case 8:
                case 10:
                case 12:
                    {
                        Console.WriteLine("本月有31天");
                    }
                    break;
                case 4:
                case 6:
                case 9:
                case 11:
                    {
                        Console.WriteLine("本月有30天");
                    }
                    break;

                case 2: Console.WriteLine("本月有28天");
                    break;
                
            }

            Console.ReadKey();
        }
    }

题目 3:利用条件运算符的嵌套来完成此题:学习成绩 > = 90 分的同学用 A 表示,60 - 89 分之间的用 B 表示,60 分以下的用 C 表示。

static void Main(string[] args)
        {
            int score = 85;
            
            string result = score >= 90 ? "A" : (score < 60 ? "C" : "B");

            Console.WriteLine(result);

            Console.ReadKey();
        }

此题用了条件运算符的嵌套,在一般开发下不建议使用嵌套,嵌套过多难以理清逻辑。

 

 

 

C#-判断语句(五)

C#-判断语句(五)


  判断语句主要有if...else、switch和 条件?语句1:语句2 三种,而if...else中又有if语句,if...else、if...else if...else和if中嵌套if这几种,但是只要掌握if...else if...else语句其他if类型语句的用法都是相似的


if...else if...else语句

  格式:
    if(条件1)
    {
      语句1 ;
    }
    else if(条件2)
    {
      语句2 ;
    }
    else
    {
      语句N;
    }
  解释:如果条件1成立,则执行语句1,如果条件1不满足则判断条件2是否成立,如果成立则执行条件2,如果不成立则执行条件N


if中嵌套if
  格式:
    if(条件1)
    {
      if(条件2)
      {
        语句2;
      }
      else
      {
        语句3;
      }
    }
    else
    {
      语句N;
    }
  解释:如果条件1不成立,则执行语句N,如果条件1满足则进入到第一个if中,然后判断条件2,如果成立执行语句2,否则执行语句3

  示例

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace ConsoleApp2
{
    class program
    {
        static void Main(string[] args)
        {
            int i = 0;
            if (i < 2)
            {
                if (i != 1)
                {
                    Console.WriteLine("所给的数为0");
                }
                else
                {
                    Console.WriteLine("所给的数为1");
                }
            }
            else
            {
                Console.WriteLine("所给的数不小于2");
            }
        }
    }
}

  结果

  


switch语句
  格式:
  switch(变量)
  {
    case 常量1:语句1;break;
    case 常量2:语句2;break;
    ...
    default 常量n:语句n;break;
  }
解释:变量与每一个case后面的常量进行比较,如果相等就执行对应的语句。执行完成后, break关键字会结束switch
如果变量与所有的常量都不相等,则执行default后语句,然后结束switch

  示例

using System;namespace ConsoleApp2
{
    class Program
    {
        static void Main(string[] args)
        {
            int i = 2, j = 4;
            char oper = ''+'';
            switch (oper)
            {
                case ''+'':Console.WriteLine(i+j);break; //两数相加
                case ''-'': Console.WriteLine(i-j); break; //两数相减
                case ''*'': Console.WriteLine(i*j); break; //两数相乘
                case ''/'': Console.WriteLine(i/j); break; //两数相除
                default: Console.WriteLine("运算符错误"); break; //处理异常
            }
        }
    }
}

  结果

  


? : 语句
  格式:
    条件?语句1:语句2
  解释:如果条件成立,则执行语句1,否则执行语句2

 

C++判断语句

C++判断语句

判断语句

C++ 编程语言提供了以下类型的判断语句。点击链接查看每个语句的细节。

语句 描述
if 语句 一个 if 语句 由一个布尔表达式后跟一个或多个语句组成。
if...else 语句 一个 if 语句 后可跟一个可选的 else 语句,else 语句在布尔表达式为假时执行。
嵌套 if 语句 您可以在一个 if 或 else if 语句内使用另一个 if 或 else if 语句。
switch 语句 一个 switch 语句允许测试一个变量等于多个值时的情况。
嵌套 switch 语句 您可以在一个 switch 语句内使用另一个 switch 语句。

今天关于WordPress 判断语句wordpress判断用户是否已经登陆的分享就到这里,希望大家有所收获,若想了解更多关于c 语言入门教程–-5 判断语句、C#- 判断语句、C#-判断语句(五)、C++判断语句等相关知识,可以在本站进行查询。

本文标签: