Recent

Author Topic: and operator  (Read 1530 times)

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: and operator
« Reply #15 on: July 02, 2022, 08:25:18 pm »
OP code can be simplified to this:

If (something='i') and cond2 then
  show_something
else
  show_something


The show_something showed him an 's' but he was sure because of the first condition (something='i') he should get an 'i' or nothing. He commented it twice in the code.

Thausand's solution told OP, he may need an extra block  So he put cond1 at the outermost. That could be the correct answer. But I tried to provide different way for OP to think and analyze by putting cond2 at the outermost. Mine emphasized on readability.
« Last Edit: July 02, 2022, 08:35:46 pm by Handoko »

alpine

  • Hero Member
  • *****
  • Posts: 1038
Re: and operator
« Reply #16 on: July 02, 2022, 08:45:43 pm »
He is also commented twice that "Shows 'S' or whatever, ..." which is obviously not true.

But yeah, it seems you're better than me in guessing because I've just short-circuited the second half of the comment.
"I'm sorry Dave, I'm afraid I can't do that."
—HAL 9000

Paolo

  • Sr. Member
  • ****
  • Posts: 499
Re: and operator
« Reply #17 on: July 22, 2022, 02:09:08 pm »
Quote
However you'd expect somebody with a couple of hundred postings to his name to know better than to post something as nonsensical as his OP, which amounted to a single character.

Can someone translate to me the meaning of the above sentence (in particular the part after comma "..which amounted to a single character"). I was unable to understand what does it means if I litterally translate (MarkMLI tlaks to "someone with a couple hundreds of posts.." that seems directed to me in this topic (Handoko has Thousand of posts).

thank you in advance.

PS: I supposed the OP was just confused on the logic of boolean expression (and OP said thanks in his answer, so that seem it was the case :D).

Lulu

  • Full Member
  • ***
  • Posts: 226
Re: and operator
« Reply #18 on: July 22, 2022, 02:31:11 pm »
a few days ago there was the full moon and its particular effects !  :D
wishing you a nice life

Handoko

  • Hero Member
  • *****
  • Posts: 5131
  • My goal: build my own game engine using Lazarus
Re: and operator
« Reply #19 on: July 22, 2022, 02:36:03 pm »
Just some misunderstandings or cultural differences. No need to be too serious. Nothing bad happened. Everything is still so peace and nice.

MarkMLl

  • Hero Member
  • *****
  • Posts: 6676
Re: and operator
« Reply #20 on: July 22, 2022, 03:18:44 pm »
Quote
However you'd expect somebody with a couple of hundred postings to his name to know better than to post something as nonsensical as his OP, which amounted to a single character.

Can someone translate to me the meaning of the above sentence (in particular the part after comma "..which amounted to a single character"). I was unable to understand what does it means if I litterally translate (MarkMLI tlaks to "someone with a couple hundreds of posts.." that seems directed to me in this topic (Handoko has Thousand of posts).

thank you in advance.

PS: I supposed the OP was just confused on the logic of boolean expression (and OP said thanks in his answer, so that seem it was the case :D).

I for one always appreciate it when somebody who raises an issue subsequently confirms that things have been sorted or explained to his satisfaction.

The point I was making was that the original message comprised an isolated fragment of code followed by a question mark, with no indication of whether the problem was that it didn't compile, compiled but crashed at runtime, didn't crash but produced incorrect results, or quite simply that OP didn't understand how it worked or why it behaved in the way he was seeing.

While somebody with little experience of this forum, of the Internet, or- arguably- of life itself might think that was a useful way to ask for help, I'd expect better of somebody who doesn't fit into one of those categories.

But as I later said, in a paragraph you appear to have overlooked (of it not overlooked, chosen not to quote):

Quote
Don't knock him: he clarified things when prodded, and said thanks when he realised the problem... which is more than a lot of people do.

MarkMLl
MT+86 & Turbo Pascal v1 on CCP/M-86, multitasking with LAN & graphics in 128Kb.
Pet hate: people who boast about the size and sophistication of their computer.
GitHub repositories: https://github.com/MarkMLl?tab=repositories

 

TinyPortal © 2005-2018