![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Newbie
Join Date: Jun 2011
Posts: 4
Rep Power: 0
![]() |
How to use the bool?
I am really new to programming so please bear with me if my question sounds really stupid. I am trying to use the boolean to decide as in the following part:
c# Syntax (Toggle Plain Text)
Last edited by Ancient Dragon; Jun 28th, 2011 at 11:05 PM. Reason: add code tags |
|
|
|
|
|
#2 |
|
Achieved Level 70
![]() ![]() ![]() ![]() ![]() Join Date: Jun 2005
Location: near St Louis, MO. (USA)
Posts: 4,091
Rep Power: 10
![]() ![]() |
Re: How to use the bool?
You really don't need the boolean in that expression. Just
if( sString == "Y"). But if you really do want to use the boolean then the correct thing is if( (B = (sStirng == "Y")) ). Notice that = is an assignment operator, while == is a logical operator. |
|
|
|
|
|
#3 |
|
Newbie
Join Date: Jun 2011
Posts: 4
Rep Power: 0
![]() |
Re: How to use the bool?
Thanks Ancient Dragon. That works perfectly.
![]() |
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Bool function | robbiewoods05 | C++ | 3 | Jun 13th, 2011 1:45 PM |
| curious problem with bool variable and references. | NiGhtMarEs0nWax | C++ | 3 | May 1st, 2010 9:02 PM |
| finding prime using bool | gmann145 | C++ | 5 | Feb 14th, 2008 5:19 PM |
| Switching bool values | Booooze | C# | 5 | Apr 21st, 2007 12:07 AM |
| Defining a bool type | nnxion | C | 6 | Oct 7th, 2005 8:39 AM |