Seasoned developers are probably familiar with the concept of a "short-circuit evaluation" for boolean operators. But I figured that not all junior developers might be aware of that specificity, so I made a video tutorial about it. As always, hope it'll be useful πŸ™Œ youtube.com/watch?v=E6igS…
πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/VincentPradeilles
πŸ“…︎ Jan 11 2022
🚨︎ report
Short Circuit Evaluation?

I have a formula written like so:

If( mi(state) != playing && doSomeFunkyThingsWith df(S), gv(global),0 )

My question is when the condition is true, does Kustom still evaluate the second output? I don't want this to be calculated unnecessarily.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/magicpuddin
πŸ“…︎ Aug 10 2021
🚨︎ report
Short-circuit evaluation when breaking out of a loop

I was trying to write some conditional breaking out of a loop in a shorter way. Normally I would write something like:

if condition
    break
end

But upon testing I noticed that the following one line also worked:

condition && break

Could this in some instances yield different behaviour? And if not might there be another reason not to use this (besides the case when one would also like to evaluate other things when condition is true)?

πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/fibonatic
πŸ“…︎ Dec 12 2020
🚨︎ report
Question about || and short-circuit evaluation

Hi all. After the code below is executed, what is the expected value of myVal? I thought it would be 1, but my code is evaluating it to 2. Why is that?

let myVal = 1 || true ? 2 : 3

Shouldn't a short-circuit evaluation occur once the value of 1 is encountered, resulting in true ? 2 : 3 not being evaluated at all?

Thanks in advance.

πŸ‘︎ 2
πŸ’¬︎
πŸ‘€︎ u/cag8f
πŸ“…︎ Nov 30 2020
🚨︎ report
We should say "treat or trick" instead of "trick or treat" so that if treat is true, then trick is not evaluated due to short-circuit evaluation.
πŸ‘︎ 957
πŸ’¬︎
πŸ‘€︎ u/fsfd1100
πŸ“…︎ Oct 31 2018
🚨︎ report
Equivalent of "Find first of" that short-circuits evaluation after a matching result is found?

Hello, /r/powershell!

I am currently writing a module to interface with a web service run by the NOC at my office. Said web service displays information about devices connected to any campus network switch, but has a particular caveat: Getting information on a switch takes about 60-90 seconds, presumably due to it doing whatever it is it does behind the scenes.

I already have a function which will, given a switch tag number and a login credential (or a valid WebSession that's already logged in), output an object that is more-or-less analogous to what the web service would display - just in an easier-to-automate format.

As it stands, locating a specific device between one or more buildings whose location is unknown requires enumerating all switches in the aforementioned buildings (already done with another script), then piping the list to the function to enumerate the list of devices attached to each switch using Foreach-Object, then piping the list to Where-Object in order to to find the device I'm looking for. This takes quite a long time when you have to run a 60- to 90-second web request for 10-20 switches in a building.

As I'm sure that my search criteria will return at-most one entry, it seems wasteful and inefficient to exhaustively search the rest of the list of switches if I've already found what I'm looking for.

Is there some (elegant) way to terminate the Foreach-Object loop as soon as Where-Object finds something that matches the criteria it's testing against?

Thanks!

πŸ‘︎ 12
πŸ’¬︎
πŸ‘€︎ u/hmmwhatsthisdo
πŸ“…︎ Jun 11 2016
🚨︎ report
Can someone give me an intuitive explanation of the steps of short-circuit evaluation?

I have come to learn that b = 2*a if a<0 else 3*a can alternatively be expressed as:

b = a<0 and 2*a or 3*a

What just happened and in what sequence?

πŸ‘︎ 5
πŸ’¬︎
πŸ‘€︎ u/nullmove
πŸ“…︎ Oct 22 2013
🚨︎ report
I called my fictional fascist government Short Circuit

Because there's practically no resistance.

πŸ‘︎ 6
πŸ’¬︎
πŸ“…︎ Jan 23 2022
🚨︎ report
Do your job, SEC! Anthony Chukumba and Loop Capital are likely short $GME. Mr. Chukumba stated he no longer follows GameStop, then lists a $10 stock evaluation and advises investors to sell. Manipulation is a crime
πŸ‘︎ 8k
πŸ’¬︎
πŸ“…︎ Sep 09 2021
🚨︎ report
A furniture factory on fire in Bhaktapur,Nepal, at around 1:26AM on 05/01/2022 due to electrical short circuit v.redd.it/sijvu7cctt981
πŸ‘︎ 2k
πŸ’¬︎
πŸ‘€︎ u/Akopalypse76
πŸ“…︎ Jan 05 2022
🚨︎ report
11th Circuit Rejects Age Bias Claim By Fired Law Prof Who Received 'Uniquely Dreadful' Student Evaluations taxprof.typepad.com/taxpr…
πŸ‘︎ 50
πŸ’¬︎
πŸ‘€︎ u/gnorrn
πŸ“…︎ May 24 2021
🚨︎ report
AM-1 Mauler β€œAble Mable” and her story. This AM-1 Mauler was getting very close to being flown on the Airshow circuit when an accident cut her career short. reddit.com/gallery/saj1gi
πŸ‘︎ 235
πŸ’¬︎
πŸ‘€︎ u/P-63_43-11722
πŸ“…︎ Jan 23 2022
🚨︎ report
short circuit be like v.redd.it/8rlqa5k3yhe81
πŸ‘︎ 320
πŸ’¬︎
πŸ‘€︎ u/Baklava21
πŸ“…︎ Jan 28 2022
🚨︎ report
How to fix electric heated blanket/quilt short circuit? reddit.com/gallery/rlnuqx
πŸ‘︎ 136
πŸ’¬︎
πŸ‘€︎ u/walkingrobots
πŸ“…︎ Dec 21 2021
🚨︎ report
I made a short album recently and I'm looking for some feedback. I'm terrible at self evaluation. Appreciate a listen! afluorescentfinish.bandca…
πŸ‘︎ 8
πŸ’¬︎
πŸ“…︎ Dec 26 2021
🚨︎ report
I need help trying to find these ceramic capacitors for my xbox one. Also where do you voltage injection it so i can find the short circuit culprit.
πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/whiteklad
πŸ“…︎ Jan 28 2022
🚨︎ report
Turned the switch on and got a "pop!", sparks flew and now my celing fan light looks like this. Is this just a short circuit in the fan, or a sign of a bigger issue in the house?
πŸ‘︎ 13
πŸ’¬︎
πŸ‘€︎ u/Chikkorita
πŸ“…︎ Jan 24 2022
🚨︎ report
SLPT: If you want to turn off the power to a light fixture or outlet but you don't know which breaker to pull, just intentionally cause a short circuit and the correct breaker will blow.
πŸ‘︎ 2k
πŸ’¬︎
πŸ‘€︎ u/dickcheney600
πŸ“…︎ Nov 15 2021
🚨︎ report
I got to watch my ultra-zealot coworker's brain completely short-circuit when someone didn't give deference to his religious holiday

I'm a Pagan, so I don't celebrate Christmas as either a secular or religious holiday. I don't talk religion at work unless someone asks or gets pushy with their own beliefs, but I also don't pretend to be Christian. I live and work in a very conservative Christian area of the U.S., so this time of year is always annoying with the zealots out in full force. Today, however, I got to enjoy watching one of their heads implode.

One of my coworkers is the most fanatical, hard-core over-the-top conservative Christian I've ever known. He never misses an opportunity to ramrod some Jesus into a conversation and he's always on the most extreme fringe he can find.

Today, while leaving for the long weekend, one of my other coworkers was wishing everyone a good weekend. She looked at me and said something along the lines of "Well, I won't wish you all a merry Christmas, since some of you don't celebrate, so just have a good weekend!" It was a very nice gesture, obviously meant to be inclusive. I appreciated it.

The zealot coworker less so. His face got instantly bright red and he sputtered out "But it's Christmas!" He then darted away and took a different path out of the building and wouldn't talk to anyone when we met back up at the time clock before practically running to his vehicle.

I know it's incredibly petty, but the fact that something so small as someone trying to be inclusive around the holidays will bother him for at least the rest of the evening is bringing me a lot of joy. I'm sure he's going to feel beyond persecuted and will have to let all his Christian friends know the horrors he's faced.

That's definitely going to get me through the rest of the holiday season.

πŸ‘︎ 212
πŸ’¬︎
πŸ‘€︎ u/StyrrErnstson
πŸ“…︎ Dec 23 2021
🚨︎ report
Since Adam Something got some traction here I thought you would enjoy how rightwingers' brains short circuit after watching his content.
πŸ‘︎ 404
πŸ’¬︎
πŸ‘€︎ u/koro1452
πŸ“…︎ Dec 02 2021
🚨︎ report
An image from a 1974 Italian encyclopedia of Monza, showing 3 tracks: the longer "road" circuit, an elevated oval known as the Piste di Alta VelocitΓ  & a short inner "junior" track. The oval was the banked circuit used in the movie Grand Prix. 52 drivers & 35 spectators have been killed at Monza. imgur.com/zLdUo6R
πŸ‘︎ 174
πŸ’¬︎
πŸ‘€︎ u/BenjyBunny
πŸ“…︎ Dec 24 2021
🚨︎ report
Short Circuit Debuted May 9, 1986 youtu.be/9rlI3Xg9g_A
πŸ‘︎ 49
πŸ’¬︎
πŸ‘€︎ u/hotbowlsofjustice
πŸ“…︎ Jan 21 2022
🚨︎ report
Peaceful Barb? Tank Sinatra? A divorce lawyer? Who are these people helping Alec Baldwin "short circuit all the negative" in his life?

"I’ve been having some very interesting phone calls with some very interesting people who I will not name but some of them rather well-known people who deal in all kinds of behavioral, philosophical, religious, spiritual, meditation, all kinds of ways to attain a state of mind where you really short circuit all of the negative in your life." β€” Alec Baldwin's instagram ramble

πŸ‘︎ 56
πŸ’¬︎
πŸ“…︎ Jan 02 2022
🚨︎ report
Its fine to do this ? Should i be worried about short circuit or catching fire ?
πŸ‘︎ 39
πŸ’¬︎
πŸ‘€︎ u/BeldoSvk
πŸ“…︎ Dec 27 2021
🚨︎ report
WRC Sweden SSS. Short technical forest rally circuit on snow and Ice. No AI, no checkpoints. My best attempt to recreate a snow forest rally on a map with no snow or forests. Planning to attempt every 2022 WRC location. Its time consuming as hell though so we'll see. Share code 334 197 713 reddit.com/gallery/s6p6jn
πŸ‘︎ 35
πŸ’¬︎
πŸ‘€︎ u/Rightclicka
πŸ“…︎ Jan 18 2022
🚨︎ report
What is the purpose of this cap at the output of my inverter? It looks like its short circuit too.
πŸ‘︎ 24
πŸ’¬︎
πŸ‘€︎ u/-Alchem1st-
πŸ“…︎ Jan 11 2022
🚨︎ report
Sometimes when we're playing he short circuits. v.redd.it/xfnnkxl1ykw71
πŸ‘︎ 7k
πŸ’¬︎
πŸ‘€︎ u/Mycatissnootsy
πŸ“…︎ Oct 30 2021
🚨︎ report
Will these pin connectors short-circuit if they touch while connected to my receiver?
πŸ‘︎ 7
πŸ’¬︎
πŸ‘€︎ u/zephyrinthesky28
πŸ“…︎ Jan 17 2022
🚨︎ report
Socializing is like a short circuit for motivation for me

Socializing is like a short circuit for motivation. I'm highly driven towards it, and I waste motivation there. Important insights can motivate posts on Reddit or writing other text to other people, after which I forget and don't apply insights. Socializing regarding hobbies can destroy motivation for that hobby. Also, little bits of socializing are the main thing which motivates me to spend lots of time online.

Now that I think about it, I wonder if only online socializing acts as a short circuit for motivation. It's hard to answer this because I experience little offline socializing.

πŸ‘︎ 8
πŸ’¬︎
πŸ‘€︎ u/is_reddit_useful
πŸ“…︎ Jan 18 2022
🚨︎ report
Found this in a middle school science book. That isn't a parallel circuit. That is a short circuit.
πŸ‘︎ 167
πŸ’¬︎
πŸ‘€︎ u/warpey12
πŸ“…︎ Dec 07 2021
🚨︎ report

Please note that this site uses cookies to personalise content and adverts, to provide social media features, and to analyse web traffic. Click here for more information.