Mom can we have Scratch? We have scratch at home. Scratch at home:
https://lemmy.ml/pictrs/image/5e55ae30-7a00-4bb8-a392-9801b4bd64d6.png
26 Comments
Comments from other communities
Isn't the logic inverted? I think you want a == 0 on each of those conditions
You wouldn't even need the first if you removed the space
Correct, noticed the same thing. Should have been a bang in front of each of the terms, your modulus of any of those will return a 0
when hit, which will convert to false
and fail each of those conditions.
This solution will do the opposite of what was intended unless the if
conditions are inverted. Then it works flawlessly and the %15
is indeed a clever solution.
Ya'know, it shouldn't be too hard to setup the ╔ and ╚ characters to function as or be substituted for quotes or brackets, depending on the language, then handle the rest as ligatures. Straight display substitution could allow for clean code and portable touch-typing, while still providing this sort of "visual training wheels" for those who want it in their own editor/ide
Huh, I had never considered this solution to fizzbuzz to be honest. I usually go for string concatenation, or (i % 3 == 0 && i % 5 == 0), but yeah i % 15 == 0 is certainly a clever simplification
I think it's worse at conveying the intention and should be a compile-time simplification (I'm too lazy to check if compilers would do it though).
Oooh, that is tempting. The main pain would be center justifying the code. Perhaps if it was left justified...
Clearly we need self-centering support from editors.
Just one more reason to do your coding in Word.
Technically that is a reason
I think the main pain would be manually aligning the frames on every line with every change, occasionally having to extend the width and updating every line of code to match it
My employer's CI rejects extended ASCII characters :(
Really? You never use the occasional \ or something?
Edit: my client actually parses the space lol
Backslashes are not extended ASCII
Just remembered not all projects have a web interface or an interface at all
That's normal, you should just use Unicode in that case.
You misspelled UTF-8
Feel free to encode it whichever way suits you best.
Unless it's ISO 8859-1, apparently.
I'm not sure if you're completely up to date on this whole Unicode thing.
I'm not sure if you're completely up-to-date on this whole encoding thing.
This only half as bad as the emoji soup macros
Got a link?
I got something better for you.
Pure art
super minor but I always preferred to define fizzbuzz as modulo 3*5 to show adherence to the instructions in the readability of the code without having to think about why
You could do this in basic ASCII, with only three defines. replace "_ " with "{", replace "_;" with "}", and "_" with nothing. If your compiler processes macros in the correct order, it will become valid code. (You would use semicolons as the vertical lines)
This would musk to write, but is honestly really readable.
Remember the meme where all the parentheses are on the right hand side? This meme is the same.
Have they
#define
d out the equals symbol? I don't think thatfor
loop is going to compile.The symbol they defined out is not the equals symbol but rather U+2550, so the for loop is fine.
why not? looks fine