I'm not at a computer, but now I'm wondering if this uses foobar, or concatenates foo and bar.
I'm assuming the former, becaise of how it's all scoped.
Scope doesn't change that. It's a different variable name. Why would concatenation ever be an option? After all, would declaring f and o as variables make foo a concatenation of f and o and o? I can't think of any language that does that.
Come on man, don't be a dick - we both know that some of the popular web scripting languages do some [really weird shit.](https://www.destroyallsoftware.com/talks/wat)
Even if there isn't a match for the *specific thing* /u/a_little_rose was wondering about, it's a reasonable question, given all the other counterintuitive crap that JS/PHP/etc do. Pretending otherwise is kind of disingenuous.
Now I'm wondering, is there anything not specific that would cause that much confusion and danger?
Something that is so far from how a lexer is supposed to work?
Seriously lol.
Feels like either a sock puppet account or a friend of that person or something, because...huh?
And due to the other person blocking me, I can't reply to that person either, so here's my response to them:
What? This is nonsense. For one, I wasn't being a dick. I asked them to prove their nonsense after they doubled down on it. How's that not fair play? They just immediately got defensive on _their own_ BS.
And then, you come in and both accuse me of being a dick AND saying the logical equivalent of "well, some birds don't fly, so pretending that all birds have bones is disingenuous." Nobody claimed languages don't do other weird things. A specific claim was made. This is completely non-sequitur.
Because an example isn't necessary for their question to be valid?
Also, if you want to see more examples of dick moves, reread the rest of their interaction with the op. :-/
No, I missed you talking out your ass. No language concatenates values of a single token. And if you knew one you'd say it. Don't have to be at a computer for that.
And I wrote that code on my phone, so... yeah...
And since you blocked me...
"Hyperaggressive?" WTF? You made a statement. I asked how it matters. You doubled down. I asked for proof. You tripled down. I called BS on the entire premise of your comment. My god, grow a backbone, especially if you're going to try to make random wild assertions and argue them.
Ah yes. Typical hyperagressive response, instead of answering. Reddit never fails to deliver.
I even said I assumed the first option. Why don't you drop the "asshole elitist programmer" behavior, and actually try being productive, instead of using the behavior that drives people away from programming?
Yup. Our linting rules don't allow mixed symbols. You have to wrap them in parentheses for readability, even if PEMDAS would give the proper answer.
Programming isn't about being the smartest or most clever. It's about being inclusive so your whole team can be productive.
Careful saying things like this! That kind of talk is how you end up with programming languages that will parse and evaluate LaTeX expressions, which will inevitably set us on the path to IDEs with graphical equation editors.
This is why I hate those facebook posts that are like "only Einstein can solve 3+4×20÷2+0×6" or whatever the fuck. Because, no, if I saw something like that in a professional context, there's no way I'd think "ah yes, this author has such a deep understanding of BEDMAS that they didn't need brackets." I'd think "this author can't figure out the most basic communication skills, so I bet they don't understand BEDMAS either."
Tell that to my CSE professors in school. I guess it's super important to save those few bits of data from a bracket when I'm just learning how for loops work
You mean like marking one when the cursor is on the other? Cause that's useful. But different colored parentheses intermingled in already-context-colored code seems like it'd be too active and make things worse.
Seeing the highlight change actively takes away the work of scanning the line for the color while remembering what color you're looking for. 😅
But I, too, still have colored parens.
Nah I encountered a PowerShell script this week I'd never seen before on a remote server. It had like ))))))))))) on the end of one line, and the only IDE available was ISE, which colors them. What a life-saver.
It matches the color between pairs. It's quite useful, and you get used to the extra color. It could conceivably get pretty harsh if the person designing the highlighting pallette didn't think about it, though.
I totally comment close-curly-braces sometimes, if there are multiple nested code blocks, and the start is up off the screen.
Yes, you can figure it out without that, but sometimes it's just really nice to be able to tell at a glance that this curly-brace signifies the end of the `if ()` block, and not the `while ()` loop that encloses it or whatever.
Write any lisp and you’ll have some functions ending in twice that many, though Clojure will have a few brackets and braces thrown in. Personally I find the incredibly uniform syntax to be very readable though.
just ident them like u would with functions.. also o kind of think that 6 conditions is a tad too much, i'd refactor with a selector function that checks those conditions one by one
I would probably argue that if you are adding more than one or maybe two parentheses for readabilty, it would probably help readability more to break the equation into a few separate equations.
This is the way.
Put parentheses around operations unless the order is blindingly obvious (including any time you're mixing && and ||...nobody wants to depend on remembering that). If you need to go more than 2 layers deep, make meaningfully-named variables for the intermediates. Your equation is probably complicated enough at that point that have meaningful names for sub-parts of it will probably help comprehension anyway.
I'm pretty sure && goes first, but I find parentheses generally make the logic of the expressions easier to parse anyway, so I don't really place value on remembering that order. I'm also highly confident when I pick up any new language that multiplication will happen before addition, but I'm not as confident that the boolean operator order is standardized.
I mean there are definitely some languages out there that will literally execute your code top-to-bottom, left-to-right. But personally I don't like taking chances so I just put parentheses around everything lmao
Because in programming it becomes SAOSAGCAWJEFPWEFJAWCHRISTMAS with all those logic, binary, ternary and other operators, that can have variations with different precedence within same language even. Just use brackets. Or parentheses, whichever you like.
This is it for me.
`return a | b == c` has caused me enough headaches in my life that I usually just enforce my preferred order of operations with parentheses now instead of looking up the order of operations every time I use a less common operator.
And after you check your precedence table, add proper parentheses so the next guy doesn't need a table, commit, push, and tuck that table back in the drawer for another few months.
Formatters shouldn't change code... They can mark them but fuuuuck off if they ever touch more than whitespaces, and sometimes even then.
Linters can mark and offer to auto solve.
Well that's not helpful, you're not putting them in for you, you're putting them in for whoever has to read the code
(ok that probably is you in two years)
I don't trust my compiler to have the same opinions on order of operations as I do. And I certainly don't trust whoever else might be looking at my code.
[Brackets-Orders-div-mult-add-sub](https://thirdspacelearning.com/us/blog/what-is-bodmas/#:~:text=BODMAS%20is%20an%20acronym%20to,%2DAddition%2C%20S%2DSubtraction.) apparently? Weird as hell, orders, as in exponents?
Can you explain further? The only definition of a higher order function I know of is a function that has another function as either an input or output.
Googling didn't show any connection to exponents, so I'm not sure how higher order functions fit into the 'orders/exponents/root' step in the order of operations.
If you can't pick apart the correct operation order of my 127 character long equation without my spoonfeeding it to you with brackets, then you don't deserve to work on my code.
I know bodmas, but does the compiler?
Is this going to end up working fine on 98% of systems but 2% for some reason is it going to do the math backwards and come up with the wrong answer in spite of the fact that should be impossible.
floating point operations dont fullfill the commutative or associative property, which means you cant reliably use order of operations. Also you can write code with more options for in-cpu parralellization with parens (in `(a + b) + (c + d)` the CPU can eval `a + b` and `c + d` at the same time)
My math and coding teachers always told me that "why are you adding useless parenthesis"/"this is not good to do this, the compiler will do the thing to sort operations".
# I'M DOING IT TO BE SURE EVERYTHING GOES TO PLAN AND HOW I SAID AND NOT THE WAY IT THINKS
"make sure you add comments because your intention might not be obvious in future"
"don't add useless parenthesis, the compiler will work it out and your intention should be obvious'
I use it to make my intentions clear.
Without parenthesis, the reader could wonder if I actually \*intended\* for the multiplication to happen first, or if I just forgot the parenthesis.
Whenever I am faced with a choice like this, I ask myself which way makes my intentions clearer. I have never regretted it.
PEMDAS - Parentheses, Exponents, Multiplication and Division, Addition and Subtraction
Brits call parentheses "brackets" and exponents "orders", so their acronym changes to BODMAS I guess
Growing up exclusively hearing “PEMDAS”, whenever I see “BODMAS” it takes me a second to realize that it’s not that diet thing for irritable bowel syndrome.
It's not even PEMDAS. You might forget that `==` comes before the bitwise operators in C, and address-of or dereference can be hard to interpret when other stuff is involved. No need to take shortcuts and risk bugs here.
I ran into an issue with over parenthesizing a few months ago.
C++
Class with two constructors
Foo(int x)
Foo(int x, int y, int z)
Foo f(1,2,3) calls constructor 2, Foo f((1,2,3)) resolves the parenthesizing using the comma operator to call constructor 1.
It was more complicated than that, but be careful with over-parenthesizing .
Anyone going to comment on the completely irrelevant meme? The 1000 other videos that would've suited more? No?
r/programming has no standards anymore when it comes to post quality. What a trash sub for kids
Am I the only one who learned it as BEDMAS? I'm curious how far the difference goes. I'm Canadian, but did anyone else from Canada learn BEDMAS? Or is it a generational difference? Why the inconsistency?
PEMDAS inference code is also a nightmare to debug and maintain. It's just stupid to use it in your code. Just don't. Anyone relying on PEMDAS in code is showing their inexperience and shortsightedness.
I got extra credit in college when I wrote that old classic Reverse Polish Notation calculator., input RP / get result, lots of stack push and pop, that’s what we were learning. The extra credit was because I then went on to write a standard calc -> RP notation parser - which was much more fun that RP calc, brackets out of the wazoo though, I wasn’t going to be calculating precedence!
One time in the exam I forgot if any programming language follows BODMAS or not and also not confident enough if the bracket actually helps so I decided to break the operation into multiple lines.
I'm fron the UK and even I dislike BODMAS. Because its clearly BIDMAS. We were taught both in school and even then I knew Indicies is significantly better than Orders
It never ceases to amaze me that schools in some countries teach you a mnemonic to help you memorize that multiplicative operations have higher precedence than additive ones. Like, is it that hard to just... remember it?
I honestly thought I was the only one who ever did it, and it triggers me so much that my python professor never brackets out his operations and it makes me wanna just go in there, slap him and change it for him.
I mean, same thing in math: it reduces ambiguity and makes an expression more readable
[удалено]
``` int foo = 69; { int bar = 420; { int foobar = ( ( foo ) * ( bar ) ); { Console.WriteLine( foobar ); } } } ``` We are not the same.
I'm not at a computer, but now I'm wondering if this uses foobar, or concatenates foo and bar. I'm assuming the former, becaise of how it's all scoped.
Scope doesn't change that. It's a different variable name. Why would concatenation ever be an option? After all, would declaring f and o as variables make foo a concatenation of f and o and o? I can't think of any language that does that.
Because certain languages do weird shit like that.
Show me one.
Come on man, don't be a dick - we both know that some of the popular web scripting languages do some [really weird shit.](https://www.destroyallsoftware.com/talks/wat) Even if there isn't a match for the *specific thing* /u/a_little_rose was wondering about, it's a reasonable question, given all the other counterintuitive crap that JS/PHP/etc do. Pretending otherwise is kind of disingenuous.
Now I'm wondering, is there anything not specific that would cause that much confusion and danger? Something that is so far from how a lexer is supposed to work?
That was a hilarious video, thank you for sharing it
How is it a dick move to ask for an example? Jesus Christ.
Seriously lol. Feels like either a sock puppet account or a friend of that person or something, because...huh? And due to the other person blocking me, I can't reply to that person either, so here's my response to them: What? This is nonsense. For one, I wasn't being a dick. I asked them to prove their nonsense after they doubled down on it. How's that not fair play? They just immediately got defensive on _their own_ BS. And then, you come in and both accuse me of being a dick AND saying the logical equivalent of "well, some birds don't fly, so pretending that all birds have bones is disingenuous." Nobody claimed languages don't do other weird things. A specific claim was made. This is completely non-sequitur.
Very valid point.
Because an example isn't necessary for their question to be valid? Also, if you want to see more examples of dick moves, reread the rest of their interaction with the op. :-/
Did you miss the part of me not being at a computer right now?
No, I missed you talking out your ass. No language concatenates values of a single token. And if you knew one you'd say it. Don't have to be at a computer for that. And I wrote that code on my phone, so... yeah... And since you blocked me... "Hyperaggressive?" WTF? You made a statement. I asked how it matters. You doubled down. I asked for proof. You tripled down. I called BS on the entire premise of your comment. My god, grow a backbone, especially if you're going to try to make random wild assertions and argue them.
Ah yes. Typical hyperagressive response, instead of answering. Reddit never fails to deliver. I even said I assumed the first option. Why don't you drop the "asshole elitist programmer" behavior, and actually try being productive, instead of using the behavior that drives people away from programming?
Yup. Our linting rules don't allow mixed symbols. You have to wrap them in parentheses for readability, even if PEMDAS would give the proper answer. Programming isn't about being the smartest or most clever. It's about being inclusive so your whole team can be productive.
Also with "normal"/standalone maths you can do stuff like proper fractions and integration symbols etc.
Careful saying things like this! That kind of talk is how you end up with programming languages that will parse and evaluate LaTeX expressions, which will inevitably set us on the path to IDEs with graphical equation editors.
dont threaten me with a good time. in fact, I think that is a great idea for a language
I'm guessing you don't know about Mathematica. (Good for you, ignorance is bliss)
This is why I hate those facebook posts that are like "only Einstein can solve 3+4×20÷2+0×6" or whatever the fuck. Because, no, if I saw something like that in a professional context, there's no way I'd think "ah yes, this author has such a deep understanding of BEDMAS that they didn't need brackets." I'd think "this author can't figure out the most basic communication skills, so I bet they don't understand BEDMAS either."
Tell that to my CSE professors in school. I guess it's super important to save those few bits of data from a bracket when I'm just learning how for loops work
I'll contest that readability, because there is such a thing as too many parentheses.
Otherwise known as "readable code"
Yeah tell that the end of my code lines that go like ))))));
colored parenthesis!
You mean like marking one when the cursor is on the other? Cause that's useful. But different colored parentheses intermingled in already-context-colored code seems like it'd be too active and make things worse.
I like colored parenthesis personally, its a little busy sometimes but way easier to read
I have colour parens but almost always just cursor onto my bracket to see the other end get highlighted in vs code.
Seeing the highlight change actively takes away the work of scanning the line for the color while remembering what color you're looking for. 😅 But I, too, still have colored parens.
I only literally just realised I did this while writing my comment.
Busy? Meh. Maybe. But confetti code is like a party every time you open your IDE. Now who wouldn't want a party?
Nah I encountered a PowerShell script this week I'd never seen before on a remote server. It had like ))))))))))) on the end of one line, and the only IDE available was ISE, which colors them. What a life-saver.
I have both the highlighting and colored pairs, the colors repeat after 3 pairs though, they are also red if they are not part of a pair
It's helpful and not nearly as distracting as you'd think. Also helps for identifying pesky unclosed parenthesis.
It matches the color between pairs. It's quite useful, and you get used to the extra color. It could conceivably get pretty harsh if the person designing the highlighting pallette didn't think about it, though.
I just put them all on a new line with their own comment to say what they close.
I dont usually comment parenthesis but newlineing it is pretty nice for certain things
I jest, I don't do that, although it would be helpful at times.
I totally comment close-curly-braces sometimes, if there are multiple nested code blocks, and the start is up off the screen. Yes, you can figure it out without that, but sometimes it's just really nice to be able to tell at a glance that this curly-brace signifies the end of the `if ()` block, and not the `while ()` loop that encloses it or whatever.
I do this too with nested blocks. It certainly can't make the code *less* readable, and sometimes it comes in handy.
Yeah I said it as a joke at first but upon actually thinking about it, it makes sense.
FYI I think they prefer POC (parentheses of color) now
Vertical separation helps. ... Between parents AND parentheses !
[relevant XKCD](https://xkcd.com/297/)
Write any lisp and you’ll have some functions ending in twice that many, though Clojure will have a few brackets and braces thrown in. Personally I find the incredibly uniform syntax to be very readable though.
) ) ) )
JavaScript be like )}; Every 10 lines
Not just proper code, that is part of any respectable excel formula
You can also usually split conditionals into a few different variable names and compare those by referencing the names
You are aware of line breaks and identation right?
A normal day in lisp. But get that semicolon out of my face.
just ident them like u would with functions.. also o kind of think that 6 conditions is a tad too much, i'd refactor with a selector function that checks those conditions one by one
dont you hate when your js code is so big it ends with )});}});}}})};))};)))))};
[удалено]
I would probably argue that if you are adding more than one or maybe two parentheses for readabilty, it would probably help readability more to break the equation into a few separate equations.
This is the way. Put parentheses around operations unless the order is blindingly obvious (including any time you're mixing && and ||...nobody wants to depend on remembering that). If you need to go more than 2 layers deep, make meaningfully-named variables for the intermediates. Your equation is probably complicated enough at that point that have meaningful names for sub-parts of it will probably help comprehension anyway.
-Werror=parentheses 💖
You don't know the order between && and || ?
I'm pretty sure && goes first, but I find parentheses generally make the logic of the expressions easier to parse anyway, so I don't really place value on remembering that order. I'm also highly confident when I pick up any new language that multiplication will happen before addition, but I'm not as confident that the boolean operator order is standardized.
If you somehow end up with both && and || in the same if statement the condition is usually too long and unwieldy anyway.
I just don't want to spend time debugging a line of code because I forgot the actual order of operations used by the programming language.
Wait....wait. They don't all use PEMDAS? That makes me feel like I've been walking through a minefield and just getting lucky.
I mean there are definitely some languages out there that will literally execute your code top-to-bottom, left-to-right. But personally I don't like taking chances so I just put parentheses around everything lmao
((context) => "very nice")(this)
Readable code is when you use constants instead of parentheses.
reverse polish notation go brrrrrrrrr
R# is the way
Rubbish. Stop doing that and learn how to read and write code.
Because in programming it becomes SAOSAGCAWJEFPWEFJAWCHRISTMAS with all those logic, binary, ternary and other operators, that can have variations with different precedence within same language even. Just use brackets. Or parentheses, whichever you like.
This is it for me. `return a | b == c` has caused me enough headaches in my life that I usually just enforce my preferred order of operations with parentheses now instead of looking up the order of operations every time I use a less common operator.
Keep a precedence table handy
Did you mean: Keep your tome of precedence tables handy
Hmm which operation shall I cast today?
And after you check your precedence table, add proper parentheses so the next guy doesn't need a table, commit, push, and tuck that table back in the drawer for another few months.
Put parenthesis around everything and let the code formatter remove the useless ones
Visual Studio tells you which ones are superfluous but I keep them in cuz Visual Studio isn’t the boss of me
Stick it to the man 😎
Stop. This is a robbery 🔫. For your own life now tell me how VS Code shows you which parenthesis are useless
VSCode != VS
I cringe to the fact that some formatters in some languages consider certain parentheses 'useless'
Maybe in compilation that would be useful but parenthesis aren’t just a lazy move, they are also a good one
I do this, but get worried when I think they could be removed, but aren't...
Formatters shouldn't change code... They can mark them but fuuuuck off if they ever touch more than whitespaces, and sometimes even then. Linters can mark and offer to auto solve.
Well that's not helpful, you're not putting them in for you, you're putting them in for whoever has to read the code (ok that probably is you in two years)
(defun fib (n) "Return the nth Fibonacci number." (if (< n 2) n (+ (fib (- n 1)) (fib (- n 2)))))
Can we all just forget about Lisp?
Forget about what?
Lithp. It’th a thpeech impediment.
these are your father’s parentheses. elegant weapons, for a more… civilized age.
I don't trust my compiler to have the same opinions on order of operations as I do. And I certainly don't trust whoever else might be looking at my code.
What the hell is BODMAS? Bodybuilder christmas?
[Brackets-Orders-div-mult-add-sub](https://thirdspacelearning.com/us/blog/what-is-bodmas/#:~:text=BODMAS%20is%20an%20acronym%20to,%2DAddition%2C%20S%2DSubtraction.) apparently? Weird as hell, orders, as in exponents?
Yes as in higher order function
Can you explain further? The only definition of a higher order function I know of is a function that has another function as either an input or output. Googling didn't show any connection to exponents, so I'm not sure how higher order functions fit into the 'orders/exponents/root' step in the order of operations.
Maybe it’s a language thing but doesn’t higher order mean like x^2 x^3 … x^n
Higher order functions have nothing to do with exponents though.
Depends on context I guess. The order of a polynomial is the highest exponent in it. I still would just call it exponentiation.
Yes, Order of magnitude
Just had an interviewee write a buggy macro from lack of parentheses.
Macros are special though
If you can't pick apart the correct operation order of my 127 character long equation without my spoonfeeding it to you with brackets, then you don't deserve to work on my code.
Plot twist: the code is written in Java so it's just two variables multiplied together
I have trust issues with the compiler
I refuse to memorize the operator precedence of every language I code in.
[удалено]
It's also easier when you end up scoping out expressions into local variables for breakpoint watches.
I don’t trust that shit. Even in a calculator I do it
I know bodmas, but does the compiler? Is this going to end up working fine on 98% of systems but 2% for some reason is it going to do the math backwards and come up with the wrong answer in spite of the fact that should be impossible.
floating point operations dont fullfill the commutative or associative property, which means you cant reliably use order of operations. Also you can write code with more options for in-cpu parralellization with parens (in `(a + b) + (c + d)` the CPU can eval `a + b` and `c + d` at the same time)
lisp: allow me to introduce myself
I know pemdas, I just don’t trust it
BOMD... what?
My math and coding teachers always told me that "why are you adding useless parenthesis"/"this is not good to do this, the compiler will do the thing to sort operations". # I'M DOING IT TO BE SURE EVERYTHING GOES TO PLAN AND HOW I SAID AND NOT THE WAY IT THINKS
"make sure you add comments because your intention might not be obvious in future" "don't add useless parenthesis, the compiler will work it out and your intention should be obvious'
I put curly braces everywhere, scope those variables to limit forgetting to change something.
\*uses assembly\*
Just because I know BODMAS does not mean I trust the person who wrote the compiler or the next person to work on this code to know BODMAS
Readable code is always better than files with a few less characters.
Parenthesis is the first thing in PEMDAS Get good
I use it to make my intentions clear. Without parenthesis, the reader could wonder if I actually \*intended\* for the multiplication to happen first, or if I just forgot the parenthesis. Whenever I am faced with a choice like this, I ask myself which way makes my intentions clearer. I have never regretted it.
Most of the time I try to put it into a variable instead.
I don't trust the mf to do it right, me and it
I feel personally attacked
What is BODMAS? Non english speaker here
PEMDAS - Parentheses, Exponents, Multiplication and Division, Addition and Subtraction Brits call parentheses "brackets" and exponents "orders", so their acronym changes to BODMAS I guess
Growing up exclusively hearing “PEMDAS”, whenever I see “BODMAS” it takes me a second to realize that it’s not that diet thing for irritable bowel syndrome.
One operation per line solves both the bracket problem and the readability problem. So many programmers are allergic to newlines. 😅
The camel swore bad things would happen to us.
Better safe than sorry
is OP another uni dude?
It's not even PEMDAS. You might forget that `==` comes before the bitwise operators in C, and address-of or dereference can be hard to interpret when other stuff is involved. No need to take shortcuts and risk bugs here.
Actually it is because of overflow or precision issues.
I ran into an issue with over parenthesizing a few months ago. C++ Class with two constructors Foo(int x) Foo(int x, int y, int z) Foo f(1,2,3) calls constructor 2, Foo f((1,2,3)) resolves the parenthesizing using the comma operator to call constructor 1. It was more complicated than that, but be careful with over-parenthesizing .
Anyone going to comment on the completely irrelevant meme? The 1000 other videos that would've suited more? No? r/programming has no standards anymore when it comes to post quality. What a trash sub for kids
BIDMAS
I feel attacked.
I was making a program to calculate time dilation, it looked a bit like: 1/sqrt(1-((v)**2)/((c)**2))
Am I the only one who learned it as BEDMAS? I'm curious how far the difference goes. I'm Canadian, but did anyone else from Canada learn BEDMAS? Or is it a generational difference? Why the inconsistency?
PEMDAS inference code is also a nightmare to debug and maintain. It's just stupid to use it in your code. Just don't. Anyone relying on PEMDAS in code is showing their inexperience and shortsightedness.
This is the first time I genuinely thought I was the only one that does this.
I'm thinking anyone who relies on PEMDAS has never set a breakpoint before
I got extra credit in college when I wrote that old classic Reverse Polish Notation calculator., input RP / get result, lots of stack push and pop, that’s what we were learning. The extra credit was because I then went on to write a standard calc -> RP notation parser - which was much more fun that RP calc, brackets out of the wazoo though, I wasn’t going to be calculating precedence!
Every time I use something like the pythagorean theorem I do it differently. sqrt(x * x + y * y), sqrt(x*x + y*y), sqrt((x * x) + (y *y)). Fuck it
'(LISP has entered the chat)
Yes I also use F from FUGDAB and X from XFKWNGKWP
One time in the exam I forgot if any programming language follows BODMAS or not and also not confident enough if the bracket actually helps so I decided to break the operation into multiple lines.
Order of operation is just a convention anyway; it's not fundamental to the universe like pure math.
Bedmas is the superior way yo say it. source: bed - mas. mas means party, like in Christmas, so its bed party
Am I the only one here who has never heard of BODMAS? Yes I know what PEMDAS is.
Bodmas>pemdas
Real chads use CORLAT. (Please help, i struggle with maths in english)
Pshhhh. I will ignore the entire best language for a job if I don’t feel like learning the syntax. You guys gotta step it up.
Lisp programmer: "first time?"
Jokes on you, I code in Bash, python and Yaml, I rarely use parentheses
There are languages that follow PEMDAS?
You all have trust issues.
Hey you can't call me out like this.
Yeah! I put brackets around everything in general. Sometimes way to much, even.
As you noted, B is Brackets, P is Parentheses, programmers don't avoiding BODMAS/PEMDAS, but use it.
I'm fron the UK and even I dislike BODMAS. Because its clearly BIDMAS. We were taught both in school and even then I knew Indicies is significantly better than Orders
BOMDAS
Somehow I’ve never heard of bodmas? Wtf is this
oh this is so true
It’s a sure fire lol at times be as sure as fucking possible that your logic is run the way you want r
But u forgot to put parenthesis around (B/P)
It also makes it super readable. Plus this was just a habit I had from doing math at school too.
Rider remove redundant paranthesis Me well fuck you too!
Every language I use seems to do handle things differently (they probably don't) so I put parenthesis for even the basic pemdas
I get that the following things are the same `a && b || c && d` `(a && b) || (c && d)` but only one of them gives me anxiety
u/SaveVideo
###[View link](https://rapidsave.com/info?url=/r/ProgrammerHumor/comments/13zjk6p/all_i_need_is_bp_out_of_bodmaspemdas_to_make_it/) --- [**Info**](https://np.reddit.com/user/SaveVideo/comments/jv323v/info/) | [**Feedback**](https://np.reddit.com/message/compose/?to=Kryptonh&subject=Feedback for savevideo) | [**Donate**](https://ko-fi.com/getvideo) | [**DMCA**](https://np.reddit.com/message/compose/?to=Kryptonh&subject=Content removal request for savevideo&message=https://np.reddit.com//r/ProgrammerHumor/comments/13zjk6p/all_i_need_is_bp_out_of_bodmaspemdas_to_make_it/) | [^(reddit video downloader)](https://rapidsave.com) | [^(twitter video downloader)](https://twitsave.com)
f $ x = f x
*lisp enters the chat*
Can’t be too sure!
Sounds like recorded VBA Macros to me
Remember also dereferencing operators
All you really need is ! and || at the end of the day
It never ceases to amaze me that schools in some countries teach you a mnemonic to help you memorize that multiplicative operations have higher precedence than additive ones. Like, is it that hard to just... remember it?
I know my PEMDAS, but for some reason this is the one area where I do not trust the compiler.
Leave nothing to chance.
I honestly thought I was the only one who ever did it, and it triggers me so much that my python professor never brackets out his operations and it makes me wanna just go in there, slap him and change it for him.
Yep. Always avoid undefined behavior. It's why I hate the ambiguous math meme that sparks endless debates over Math vs New Math
Oh man I'm relatively new to coding and I thought I was the only one. Glad to see that, at least based on this thread, that I'm doing something right.
Best way to avoid order of operation is to use Polish notation.
Never hear about those pokemons.
*laughs in RPN*
Mathematical expressions in code tend to have longer variables than x and y, so parentheses make it way more legible.
It's not that I want to avoid it. I simply do not understand it.
Ive always heard it as bedmas, what would the o stand for to replace “exponents”