13 Replies
problem in line 4
but idk why
What problem?
You need to declare the array properly
new[]{true, true, false}
Or new bool[]{true, true, false}
The {a, b, c}
syntax works only when the type is apparent on the left side of assignmentlike what?
int[] foo = {1, 2, 3}
identifying array first is much better 🙂
and it looks cleaner
Output: 2
!closeClosed!
heya ryan, one little tip:
if( item == true )
can be written simply as if (item)
because item
is already a boolean value 😉nice to know that thanks 😄
you are helping everytime 😂
in
if (condition)
the condition
must be an expression that results in a boolean value, so someBool == true
is the same someBool
someBool == false
(or someBool != true
) is the same as !someBool
(!
is an unary operator to negate the boolean value, so true becomes false and false becomes true)
others code and mine 😄
solving it with just 1 line
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.