CBool Function

λ¬Έμžμ—΄ 비ꡐ λ˜λŠ” 숫자 비ꡐλ₯Ό λΆˆλ¦¬μ–Έ μ‹μœΌλ‘œ λ³€ν™˜ν•˜κ±°λ‚˜ 단일 숫자 식을 λΆˆλ¦¬μ–Έ μ‹μœΌλ‘œ λ³€ν™˜ν•©λ‹ˆλ‹€.

ꡬ문:

CBool (Expression1 {= | <> | < | > | <= | >=} Expression2) λ˜λŠ” CBool (Number)

λ°˜ν™˜ κ°’:

Bool

맀개 λ³€μˆ˜:

Expression1, Expression2: 비ꡐ할 μž„μ˜μ˜ λ¬Έμžμ—΄ λ˜λŠ” 숫자 μ‹μž…λ‹ˆλ‹€. CBool ν•¨μˆ˜λŠ” 식이 μΌμΉ˜ν•  경우 Trueλ₯Ό, κ·Έλ ‡μ§€ μ•Šμ„ 경우 Falseλ₯Ό κ΅¬ν•©λ‹ˆλ‹€.

Number: λ³€ν™˜ν•  μž„μ˜μ˜ 숫자 μ‹μž…λ‹ˆλ‹€. 식이 0일 경우 Falseκ°€, κ·Έλ ‡μ§€ μ•Šμ„ 경우 Trueκ°€ κ΅¬ν•΄μ§‘λ‹ˆλ‹€.

λ‹€μŒμ€ CBool ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ Instr ν•¨μˆ˜λ₯Ό μ‚¬μš©ν•˜μ—¬ κ΅¬ν•˜λŠ” 값을 ν‰κ°€ν•˜λŠ” μ˜ˆμž…λ‹ˆλ‹€. 이 ν•¨μˆ˜λŠ” μ‚¬μš©μžκ°€ μž…λ ₯ν•œ λ¬Έμž₯에 "and"λΌλŠ” 단어가 μ‘΄μž¬ν•˜λŠ”μ§€ μ—¬λΆ€λ₯Ό κ²€μ‚¬ν•©λ‹ˆλ‹€.

Error codes:

5 잘λͺ»λœ ν”„λ‘œμ‹œμ € ν˜ΈμΆœμž…λ‹ˆλ‹€.

예:

Sub ExampleCBool

Dim sText As String

    sText = InputBox("Please enter a short sentence:")

    REM Proof(Β»andΒ«κ°€ λ¬Έμž₯에 λ‚˜νƒ€λ‚˜λŠ” 경우)

    REM Instead of the command line

    REM If Instr(Input, "and")<>0 Then...

    REM the CBool function is applied as follows:

    If CBool(Instr(sText, "and")) Then

        MsgBox "The word Β»andΒ« appears in the sentence you entered!"

    EndIf

End Sub