Share orelse vb.net

lykimwetter

New member
## Orelse vb.net

## orelse trong vb.net là gì?

Orelse là toán tử logic trong vb.net trả về toán hạng đầu tiên nếu nó không phải là null hoặc không, và nếu không thì trả về toán hạng thứ hai.Nó tương đương với | |toán tử trong C#.

## Cú pháp của Orelse

Cú pháp của Orelse như sau:

`` `
Biểu thức1 orelse biểu thức2
`` `

Ở đâu:

* Biểu thức1 là toán hạng đầu tiên.
* Biểu thức2 là toán hạng thứ hai.

## Ví dụ về Orelse

Sau đây là một số ví dụ về Orelse trong vb.net:

`` `
Dim x như số nguyên = 10
Dimer y as integer = 20

'Trả về 10
In (x orelse y)

'Trả về 20
In (Y Orelse X)

'Trả lại "Hello World"
In ("Hello World" Orelse "")
`` `

## Phần kết luận

Orelse là một toán tử logic hữu ích trong vb.net có thể được sử dụng để kết hợp hai biểu thức thành một.Nó tương đương với | |toán tử trong C#.
=======================================
## OrElse VB.NET

## What is OrElse in VB.NET?

OrElse is a logical operator in VB.NET that returns the first operand if it is not null or zero, and otherwise returns the second operand. It is equivalent to the || operator in C#.

## Syntax of OrElse

The syntax of OrElse is as follows:

```
expression1 OrElse expression2
```

where:

* expression1 is the first operand.
* expression2 is the second operand.

## Examples of OrElse

The following are some examples of OrElse in VB.NET:

```
Dim x As Integer = 10
Dim y As Integer = 20

' Returns 10
Print(x OrElse y)

' Returns 20
Print(y OrElse x)

' Returns "Hello World"
Print("Hello World" OrElse "")
```

## Conclusion

OrElse is a useful logical operator in VB.NET that can be used to combine two expressions into one. It is equivalent to the || operator in C#.
 
Join Telegram ToolsKiemTrieuDoGroup
Back
Top