6 ms·
For two options, almost certainly not ;-) For N ports, or for a port list defined from a config file however it could be. It's even nicer in python: port
by yeahbutbut 12y ago
For two options, almost certainly not ;-)
For N ports, or for a port list defined from a config file however it could be. It's even nicer in python:
ports = [80, 443, ...]
if port in ports and http:
...
Or with underscore:
var ports = [80, 443, ...];
if(_(ports).contains(port) && http) {
...
}
Good collections make it better than manually checking the return code or checking an explicit set of port values. Also configuration > magic_nums.