3 ms·
There might be reasons to use `bc` like this if you don't know the type of `age` and it could be a non-numeric string. Buuuuut a programming language where a si
by jimrandomh 2y ago
There might be reasons to use `bc` like this if you don't know the type of `age` and it could be a non-numeric string. Buuuuut a programming language where a simple integer-comparison leads to two subprocesses is going to be slower than the slowest existing programming languages, by orders of magnitude.
- chme 2y agoRight. And the check/type validation shouldn't happen on comparison, but on assignment and only if it is dynamically assigned.
- sgarland 2y agoAm I missing something, like `bc` can parse `one + two`? Input sanitizing should be done before trying to hand inputs over to be summed.
- chme 2y agoThe amber source of that is [here](https://docs.amber-lang.com/basic_syntax/basic_syntax https://docs.amber-lang.com/basic_syntax/basic_syntax) and contains: // Define variables let name = "John" let age = 30 // Display a greeting echo "Hello, my name is {name}" // Perform conditional checks if age < 18 { echo "I'm not an adult yet" } else { echo "I'm an adult" } So there is no input, everything is known statically. No sanitation required. Any additional checks done by amber in the bash code is unnecessary.