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

Please support us!