In Gintama, aliens have conquered samurai-age Japan and brought over many of their technological advancement. Most of the main cast sticks with katanas.
Justified with the Gunmen in Tengen Toppa Gurren Lagann. In the second half of the story Gunmen were being decommissioned in favor of the Gunparls. When the Anti-Spirals attacked however, the Gunman fared far better, because while the Gunparls were the more advanced machine, the Gunmen had been designed specifically to fight that particular enemy.
In Sword Art Online, there is a game where guns are the primary weapon. There is a sword available, but it is largely regarded as a joke weapon. Kirito, being the hero, picks it and manages to slice bullets in half.
A Certain Magical Index: Justified considering the usage of history as artifacts. We have Curtana, Durandal, and Hrunting. Whether Saint Peter's Cross counts as a weapon In-Universe is up for debate.
Lupin III: Goemon has an obsession with the past, and believes that the Katana is the ultimate weapon. Guns are a poor argument, because he can slice the bullets out of the air, making them fall to the ground.
Black Lagoon is a series where nearly everyone is either a gunslinger or a noncombatant. Even so, two characters use edged weapons to lethal effect.
Shenhua, a Chinese assassin in the employ of the Kan Yi Fan Triad, favors a pair of kukris with the handles tied together with a length of rope. In her first appearance she beheads a pair of Abu Sayyaf mooksfrom a moving car by by throwing one of them like a boomerang.
Ginji Matsuzaki of the Washimine-gumiyakuza carries a shirasaya, or a katana in a simple wooden scabbard. He's incredibly lethal with it, including the ability to slice bullets out of midair, and in the final chapter of that story arc proves an even match for Revy until she gets lucky and manages to get one of her pistols under his chin. And he still stabbed her in the leg before she blew his head off.
X-COM: Resurrection takes a The Musketeer approach to this, arming most of X-COM's warriors with swords and axes in addition to advanced weaponry. They seem to have replaced pistols with them.
Star Wars has always had the lightsaber as the primary weapon of the Jedi and Sith in an era where Frickin' Laser Beams normally rule the day, and they get away with it because the wielder has limited precognition and the blade reflects blaster fire and goes through nearly anything without slowing down. However almost nobody else uses them and for good reason, as it really does require superhuman reflexes to avoid cutting oneself into pieces, never mind blocking blaster fire. Melee weapons are more commonly vibroweapons and may even be alloyed with cortosis to fight lightsaber-wielding Force users.
Serenity has a lot of this, with the Operative's katana, Inara's bow and the Reavers' various bladed handweapons. The Operative is just that good and also uses period-appropriate weaponry, the RPG explains that Inara's bow has been updated with modern technology to where its arrows strike with nearly the force of a bullet, and the Reavers plain don't care.
In Animorphs, Ax notes at one point that human firearms are no match for the energy weapons of the Yeerk and Andalites, but still do a good job of blowing large, messy holes in you.
In Dune personal shields block projectile weapons and lasers trigger nuclear explosions when they hit them, but a slow-moving blade can slip through.
Though since shields attract Sandworms they're not used on Arrakis. So the Fremen have spring-loaded poison dart guns and the Baron Harkonnen revived artillery for his coup.
The Legends of Dune prequels also have this, even before the invention of the shields. For some reason, in the middle of the Robot War, thousands of troops still rush into battle wielding clubs and swords. And so do the machine troops, for some reason.
In The Forever War the first stasis fields slow down anything faster than 16.3 m/s, forcing people fighting within them to use melee weapons or bows and arrows.
Both justified and subverted in the Vorkosigan Saga. The Barrayarans began the Cetagandian war with primitive weapons. However they switched to modern weapons as soon as they could get them and learn how to use them.
Justified in Lamb Among the Stars, by Chris Walley. Krallen armor is a ceramic that absorbs and dissipates energy weapons, and shaped so that projectiles deflect off except when hitting at the perfect angle. The Assembly uses its superior materials science to molecularly optimize a blade for cutting through it, which proves to be a key advantage in the series.
Lampshaded in In The Courts of the Crimson Kings. It opens with a group of science fiction writers watching the first images sent from Mars, which shows the natives are carrying swords along with rifles. One man speculates there's some kind of honor code involved, only for it to be pointed out that this gives the cheaters too much of an advantage. Turn out Martian projectile weapons are Organic Technology which take a while to reload, so edged weapons are still needed to defend yourself in the interval.
In Sergey Lukyanenko's A Lord from Planet Earth trilogy, advanced weapons are all over the place (outside of Earth, that is), from simple blasters to planet-destroying quark bombs. And yet, there also exist "neutralizing fields" that can be used to shield an area from any destructive energy and explosions of any kind (e.g. chemical, nuclear, Anti Matter). Thus, within these fields, which are used all over the place, only bladed weapons can be used. Now, they're not your typical swords, though. These are monoatomic (or planar) swords produced exclusively on planet Tar. These Absurdly Sharp Blades can cut through any known material with ease, even each other (i.e. no Blade Lock possible). Given this fact, swordfights look very different from what one expects, as each opponent tries to hit the other's sword at just the right angle to make sure that it's the other sword that gets cut. Being a Combat Pragmatist from Earth, the main character immediately devises other weapons and techniques that completely disgust and baffle the Honor Before Reason soldiers (at least, until they start using those same weapons and techniques themselves).
In Andrey Livadny's The History of the Galaxy series, everybody uses Gauss weapons firing tiny metallic spheres as everyday weapons. However, these small arms are woefully ineffective against armored targets. Not so with "ancient" automatic rifles firing chemically-propelled bullets (which somehow work despite centuries of not being used). Then again, this trope is much less prevalent, and advanced technology usually wins the day.
Lampshaded in Cryptonomicon about Japanese in a WWII battle (paraphrased):
"Shoot the one with the sword first."
"Because he's the officer?"
"No, because he's a madman running at you with a sword!"
Played with in Honor Harrington. Honor's chemical-propelled "hand cannon" revolver sneaks through a weapons scan designed to detect the much more powerful grav-powered pulsers, and 10-mm chemical pistols are still the standard weapons for a duel. On the other hand, pistols are preferred to pulsers for dueling because they're actually less powerful: A pulser hit is much more likely to be lethal, and most duels are fought to first blood.
A variation in Dances on the Snow, the Phages on planet Avalon are Jedi-like genetically-engineered special operatives (although they hate the term "Jedi" as trivializing) whose main weapons are semi-sentient plasma whips that can incapacitate a person or change shape. A Phage admits that a plasma whip is Awesome, but Impractical as a weapon compared to a more trusty blaster but it has an enormous psychological effect on bad guys and is a signature weapon of the Phages.
Played with in Deathstalker: despite having really impressively effective disruptors, most fights are settled at sword point, as unless you have a starship's power supply to hook them up to, a disruptor takes 2 minutes to recharge. Chemically-propelled kinetic weapons (ie- bullet shooting guns) do exist in the setting, and are far more efficient, but are mostly forgotten about thanks to a concerted effort in the setting's past to ban them.
The Klingons love their Cool Swords like the bat'leth, but Deep Space Nine makes a point of mentioning that an old lady with a phaser is worth a dozen Klingons with melee weapons. On the other hand a Star Trek: Voyager episode shows a group of holographic Klingons armed with bat'leths handily defeating a group of submachinegun-armed Germans (also holographic). Granted, anyone would panic at the sight of angry Klingons charging at you, but still.
In Star Trek: Deep Space Nine Worf favors a smaller weapon called a mek'leth that proves more practical in close quarters, and at one point he snaps Jadzia's bat'leth clean in half with it.
Also in DS9, the Jem'Hadar are perfectly happy to use the Frickin' Laser Beams equivalent of an assault rifle most of the time, but at melee range they switch to a short, bladed polearm called a kar'takin.
The DS9 episode "Field of Fire" spoke of Starfleet experiments with chemical-propelled firearms for use in environments that render phasers useless. However they eventually just put out a new, more resilient model of phaser.
Stargate SG-1 plays a little with this with Goa'uld personal deflector shields. Energy weapons and bullets have no effect on them but they can be penetrated by slower-moving objects, a fact exploited by SG-1 on two occasions (for instance, Jack O'Neill throwing a rifle bayonet through Heru'ur's shield and through his hand in "Secrets"). In most other cases though, guns, regardless of form, rule the day.
In the Buffyverse, vampires and demons prefer to use either their teeth and claws or edged weapons rather than firearms, as do Vampire Slayers and other demon fighters. There are notable exceptions, more so in the Angel spin-off which is set in Los Angeles with vampires etc acting as part of (and therefore influenced by) the criminal subculture. The trope is lampshaded in "Bad Girls" when the modern-thinking vampire Mr. Trick remonstrates an opponent who comes at him with a sword.
"Why do they always gotta be using swords? It's called an Uzi, ya chump! Could have saved your ass right about now."
For the slayers there is a justification: guns don't kill vampires (or demons) and the gunshot can attract innocent bystanders. Darla however makes a point of shooting Angel because although it won't kill him getting shot will still put him out the fight, which makes one wonder why demons hunters don't shoot vampires and stake them while they're down. Fortunately explosives can still bring down even the biggest monster and The Scoobies use this fact from time to time
Firefly: Despite space travel taking place most people use lever action rifles or revolvers. Justified in that the setting is basically Cowboys in Space and that the planets are in the process of being colonized and they only have what they need (the Alliance gear is much shinier and spacey).
The Walking Dead takes place in the modern American South, where there's no shortage of guns, but the extensive use of crude impact weapons is justified by the fact that most of the ammo was used up in the early weeks of the zombie outbreak. (This justification is also often subverted when our heroes spray-and-pray their allegedly-scarce ammo in the best action-movie tradition.)
Gunshots (or any noise) draws in nearby walkers, one of the reason Daryl's crossbow is so important, and what causes the issues time and time again. Guns tend to be a last resort for this reason, though when other humans are around (who don't have to be next to you to kill you and are able to think and plan) it almost always turns into a firefight.
Many times simple pits and traps are shown to be a great defense because the walkers can't think and walk into the trap. The season shows many times the use of simple solutions to problems.
In the MechWarrior RPG, swords are described as still being a preferred weapon aboard starships because combat will invariably be close quarters and the blade won't rupture the ship's hull as opposed to firearms. In the base BattleTech game, some BattleMechs carry hatchets, or (more rarely) swords alongside their lightning guns and railguns. Hatchets are basically lumps of endosteel or ferro-fibrous armor which is gripped by the mech (or built into its arm). Hatchets have the advantage of dealing tremendous damage for relatively little weight, generate no heat, and have no ammo. Swords deal less damage but are more accurate due to them being better balanced. Other more advanced weapons exist for both infantry and battlemechs, such as Vibroblades. In the Solaris Arena gladiatorial arenas, more oddball weapons such as flails, maces, and pile drivers are used in battlemech and Powered Armor combat, though more for their wow-factor than for their actual effectiveness.
Warhammer 40,000 gleefully mixes melee weapons like swords and warhammers up with Frickin' Laser Beams, Tank Goodness, and dueling starships among other things. Of course, the old-school weapons are almost invariably updated with current technology (it's not just a sword, it's a chainsword or power sword). The page picture is the source of a meme where an Imperial Guard commissar, despite riding atop a Leman Russ main battle tank at the time, still wanted to get up close and personal:
"DRIVE ME CLOSER! I WANT TO HIT THEM WITH MY SWORD!"
The Imperial Marines of Traveller have a thing for cutlasses, as they don't ricochet in cramped spaceship corridors and hit sensitive equipment like bullets. Though they're mostly ceremonial.
Fading Suns also has melee weapons frequently used in boarding actions because they don't ricochet, and spaceships are Lost Technology and thus extremely valuable so the attackers generally don't want to wreck anything. And there aren't too many manufacturers of guns or higher tech weapons left in operation.
Common in The World of Darkness games such as Vampire: The Masquerade and Werewolf: The Apocalypse. Hand weapons can be much more effective than firearms in the hands of supernatural creatures, to say nothing of their natural claws and fangs. In addition, firearms cause "Bashing" damage to vampires rather than the "Lethal" damage caused by blades because organ damage is meaningless to undead.
Melee weapons are common in the cyberpunk-verse of Shadowrun, ranging from period-proper combat knives to katanas, battle axes and swords. Certain tradition-fond megas, like Aztechnology and Renraku, make a point of equipping their Elite Mooks with melee weapons to reinforce their image.
The Final Fantasy series loves this trope since VII, with guns often being weaker than melee weapons like swords and spears.
In Makai Kingdom, there are loads and loads of weapon types. There are modern weapons like rifles, bazookas, or flamethrowers available, but also classical weapons like swords and spears. Or silly weapons like UFOs, Pies, Syringes, or Paper Fans. Heck, there are even giant mechs available to ride. Being one of the creations of Nippon Ichi somewhat justifies it; they love their Widget Series.
Throughout the series, particularly Metal Gear Rising: Revengeance, most of the elite cyborgs favour swords and other melee weapons over guns (in Rising, Mooks use guns, but the Elite Mooks use giant hammers and most of the UGs have some form of melee weapon or other). It's justified by explaining that bullets don't have the energy to get through cyborg armour, while HF Blades and other advanced weapons do.
Taken to the Logical Extreme in Rising, where the final boss is too technologically advanced and too strong to use any weapon but their fists.
This also comes into play with the difference between Raiden's and Sam's swords. Raiden's HF blade was specifically made for him after losing the one he had in the prologue chapter, and so is not the greatest weapon around. Sam's, however, was created from an original 16th-century katana, and so is among the greatest HF blades currently in existence.note Yes, every single thing about Sam is justified with little more than "because he's a SAMURAI!"
Fridge Brilliance with Gray Fox: he's an assassin using a stealth suit and firearms, even silenced ones, would give away his postion. Using a katana he can get close enough to use it for assassination without being detected.
The Persona series frequently displays this trope, having gun-wielding characters fighting alongside those with swords, spears, boxing gloves, fans, and folding chairs.
Lampshaded in Persona 3, where Personae are summoned by shooting yourself in the head with a very realistic (but thankfully not real or loaded) pistol. Yukari asks Detective Kurosawa why he procures you more fantasy weapons like swords, bows and knives when better weapons exist. Kurosawa explains that is would not be hard to confuse a pistol-like object with an actual pistol. Let's just say, it's a mistake you'd only make once. Incidentally, Aigis can use guns, and very effectively at that, but she is a gynoid/weapons platform and doesn't need an Evoker.
What determines how hard you can hit a Shadow isn't the force of the weapon, it's the force of your emotions channeled through it. A gun creates an emotional distance between you and the target (at least for most people), hence why most people with firearms won't cause nearly as much damage (if any at all) against shadows as would someone hitting them with a sword or even shooting with a bow. Aigis, who is herself a weapon (all of her weapons are built into her robotic body), obviously has no problem expressing her emotions through them, as does Naoto (who uses a revolver in battle) due to her extreme obsession with seeing herself as a cop.
Fable III: Despite fire arms becoming common enough to be used by the military, being flintlock pistols and muskets they are slow to reload and as seen Mourning Wood monsters tend to charge with vast numbers which means infantry men, with simple swords, still play a vital role in combat.
In the first and second games, this is justified by the protagonists being on planets protected by an Alien Non-Interference Clause. The first game's end boss is further mentioned as being immune to modern weapons, so the melee weapons and Symbology of the 'primitive' planet are the only things that can hurt him.
The third game has the same justification, but halfway through the game you return to "civilized" space, and yet many of the protagonists continue to use anachronistic weapons.
In Team Fortress 2, one of the Sniper's weapons, alongside a host of various rifles, is a bow-and-arrow set called "The Huntsman". It can be very effective. Also, the various melee weapons, from the Spy's butterfly knife, the Pyro's "axetinguisher" or the Demo's huge host of broken bottles and swords call all be very useful.
In World of Warcraft, Hunters and Warriors can choose among rifles or bows. The competence and damage difference is negligible. That's of course, when they aren't using axes, swords or hammers...
Command & Conquer: Red Alert 3 had the Beam Katanas, a special ability for the basic infantry for the Empire of the Rising Sun that changed their rifles into beam katanas. The Red Alert series runs almost entirely on Rule of Cool, and in the scenario the sword is an old idea but still scores one hit kills (assuming they get near enough for it and clear garrisoned buildings to boot).
Fallout is an interesting case, mostly because of the nuclear war ending society. Energy weapons are highly accurate but are either weaker than conventional fire arms (laser), or strong but slow moving (plasma) and always a pain to find until mid-late game. Small guns are diverse but can break, jam or just plain miss a lot more and ammo is always scarce for big guns (which have the same issue as small guns, though pack a larger punch). Melee weapons are durable and can be strong (sometimes augmented with technology), always silent and with the correct armor you can close the distance with ease, and can be found on pretty much any raider, giving you a constant supply of spare parts, and while using unarmed is challenging at first it has some of the best perks for combat and several gloves with devastating effects. As such using any of them is viable and has its own strengths and weaknesses.
Caesar's legion scorns the use of firearms because of the dependence on ammo and possibility of the gun jamming: Only the Elite Mooks use any kind of gun and Caesar's guards are all unarmed experts so they are never without their weapons. Despite the NCR having a technological edge (though you are told that most soldiers only get the most basic gear (sometimes not even that if they're somewhere unlikely to see action due to costs) they've been locked in stalemate with the legion at Hoover Dam for years...
In the same vein the Brotherhood of Steel was beaten back by the NCR after their disagreements (though this was more because NCR troops outnumbered the Brotherhood over 25 to 1 in New Vegas alone
Lampshaded in Mass Effect 2 with the M-96 Mattock semiautomatic rifle, which has the highest base damage of any assault rifle in the game despite being relatively outdated in-universe. The "Firepower Pack" DLC that adds it to your inventory in 2 comes with an e-mail from the Illusive Man saying that EDI had told him "we may be overlooking older, proven technologies in an effort to provide you with the state of art."
A simple grenade launcher is the first heavy weapon you get and is vital against the Ymir on Freedom's Progress
A couple types of Cerberus mooks in Mass Effect 3 are armed with melee weapons, as is the Illusive Man's Dragon, katana-wielding Kai Leng. This is lampshaded in the "Citadel" DLC in an overheard conversation between a couple of Alliance soldiers:
The game continues the Klingon trend of charging right in with a bat'leth instead of staying back and shooting, and adds a couple lesser-known types of edged weapons (Vulcan lirpa and Tsunkatse falchions). Given a justification this time: basically everyone has a personal deflector shield that works fine against ranged weapons, but 80% of melee damage, whether from a sword, Pistol-Whipping, or Kirk-fu, goes straight through to the target's HP. This is especially useful against the Borg, who will adapt over time to energy weapons and force you to re-frequence, but against certain types of drones also leaves you open to a One-Hit Kill by assimilation.
Despite having originally been built 130-odd years ago by the time of the game, the Excelsior-class is considered one of the top four DPS cruisers on the Starfleet side. (At the bottom of the top four, granted, but it still beats out the too-much-tank-not-enough-DPSGalaxy-class.)
In the shuttle PVP added in the Season 8.5 update, the TOS-era Type F shuttle is considered one of the top competitors, regularly beating players flying Peregrine-class attack fighters or runabouts from DS9. This is roughly the equivalent of a World War I biplane shooting down an F-22.
Crysis 3 has the Predator bow, a bow-and-arrow in an era of railguns and strange alien weaponry. Its biggest advantage is that it is a completely silent weapon, but it also has other features. Its draw strength is something like 500 pounds, perfect for the nanosuit's Maximum Strength. The arrows all have beacons that only the nanosuit can see (and you can tag those arrows with your GPS binoculars if you so choose, implying recon possibilities beyond the scope of the actual missions), and the special explosive arrows can airburst in proximity to a binocular-tagged enemy.
The crossbow in RAGE. It's quieter than the various firearms and robotic gadgets that make up the rest of your arsenal and is accurate enough to outperform your Sniper Rifle at all but the longest ranges. You also get a couple types of Trick Arrow for it that come in handy in various situations.
Far Cry 3 Has you fight pirates and privateers with everything from pistols and rifles to flamethrowers and grenades but one of the best weapons in game is a recursive hunting bow, despite the fact that it can be hard to aim it. Justified because it is completely silent, you can recover the ammo from enemies and it is designed to bring down tigers and other large predators. For similar reasons stealthily killing your enemies with your machete is often much better than picking them off with silenced firearms: you don't have to worry about people realizing they're being shot at, it doesn't use ammo, take downs are an insta-kill and there are a variety of upgrades allowing takedown to be used in a variety of situations (such as jumping on enemies, booby-trapping them, killing heavies etc.)
In Terra, set in the 24th century, Catella Myrhadual wields a pair of scimitars against people armed with assault rifles. It helps that her armor contains a deflector shield generator that No Sells small arms fire. Melee attacks can penetrate it but she's good enough that this usually isn't an issue. Operative word being "usually". Agrippa Varus disarms and immobilizes her with almost contemptuous ease.
Owing to short-sighted defense cuts between the wars, the Royal Navy entered WWII with biplane fighters and bombers to equip its aircraft carriers. Yet the Fairey Swordfish managed to catch most of the Italian Navy in its home port of Taranto, causing widespread destruction in an attack the Japanese studied and emulated at Pearl Harbor. A year or so later, it was a carrier-launched Swordfish biplane which fired the torpedo that crippled the Bismarck, leaving Germany's most modern battleship wide open for the surface fleet to catch up with her.
For similar reasons (as well as the fact that a significant fraction of the Soviet Air Force was caught on the ground in the opening days of Barbarossa), the 588th Night Bomber Regiment (Night Witches) in the Soviet Union had to fly the interwar-era Po-2 biplanes. Though hopelessly obsolete compared to Messerschmitts or even the aforementioned Swordfish, these planes proved to be tremendously manouevrable and capable of extended unpowered gliding, permitting them to approach German positions without any noise beyond the wind in the wings; their low top speed, below the stall speed of German fighters, made them exceptionally difficult to intercept in the air; and their simple but sturdy construction made them exceptionally durable and resilient under enemy fire. Their nightly harassment thus caused the German invaders no end of grief, and led to a psychological and morale impact on the Wehrmacht far out of proportion to the actual material losses inflicted. They proved their effectiveness as night bombers again in the Korean War, where the wooden airframe of the "Bedcheck Charlie" gave the venerable biplane another significant advantage in modern warfare - a negligible radar cross-section that made detection no easier than it had been for the Germans, in spite of now-ubiquitous radar systems.
Even the Americans didn't avoid this trope entirely. Front-line US Navy units used biplanes such as the Grumman F 3 F and the Curtiss SBC Helldiver as late as 1941. Meanwhile, in the Philippine Islands, some of the American and Filipino defenders flew Boeing P-26 Peashooters, with their wire wing braces, fixed landing gear, and open cockpits, against the attacking Japanese forces. Despite their obsolescence, they achieved several victories against Japanese bombers and fighters in the first few weeks of the war.
Both Great Britain and Russia had obsolete heavy machine guns left over from World War I. The Russian Maxim and the British Vickers were effectively the same weapon, but one which required two or three men to transport, emplace and fire. It was also water-cooled, so if no water was available the weapon would overheat and become unworkable. The German MG42 was air-cooled, had a faster rate of fire, could be emplaced in seconds as opposed to fifteen minutes, and used by one man. Both Britain and Russia eventually hit on massing these weapons together to minimize these weaknesses and to provide saturation firepower, effectively using them almost as emplaced artillery and not as tactical infantry MG. British machine-gun battalions proved destructively efficient in Italy, where multiples of 64 Vickers MGs fired together at one section of German front to soften it up for an attack, allowing the attacking infantry to get as close as they could whilst returning fire was suppressed.
Close combat in the Burmese jungle often pitted Japanese officers and noncoms armed with swords against machete-armed British soldiers. Or kukri-armed Gurkhas. Or Sikhs with the traditional tulwar sword. Or African troops with native swords from Nigeria, Kenya, etc. Bladed weapons could be silent, deadly and ultra-effective in close quarters jungle fighting and ambushes, and sword fighting in combat happened even in 1942-45. Also, tribal units and natives fighting alongside British Fourteenth Army and on Borneo used native weapons, such as blowpipes and bows and arrow, to deadly effect in close-quarters jungle fighting.
And narrowly averted with Croft's Pikes. Due to a bit of Winston Churchill's hyperbole being taken at face value, the War Office ordered the production of 250,000 steel pikes for the Home Guard. This understandably caused quite a fuss (and did no small degree of harm to the morale of the Home Guard troops), and the weapons were never issued as a result. The whole thing is named for Under-secretary of State for War Henry Page Croft, who tried to defend the decision due to the pike being "a most effective and silent weapon".
Much fighting in World War 1 took the form of "trench raids", where soldiers would scramble out of a trench, sprint across the open ground, and drop into an enemy trench. Rifles were cumbersome in the narrow, zig-zagging trenches, and combat was typically at very close quarters. Pistols had limited stopping power and attracted reinforcements by their noise, and any mechanical device was subject to malfunction in the ever-present dirt and muck. Soldiers rapidly discovered that knives, clubs, and other simple melee weapons were frequently the best choices. The classic 1918 trench knife, with its brass-knuckles handle, was born in this environment, and the humble shovel (which everyone had with him anyway) rapidly became a favorite as an improvised tomahawk. To this day entrenching tools are often specifically designed to have one edge sharpened for use as a weapon.
Many people live in places where guns are banned, culturally frowned-upon, or hard to obtain without dealing with the very same dangerous characters one is hoping to avoid. In such places, archaic or improvised weapons often become the best option for those seeking to avoid both victimization and prison. Some examples include sturdy flashlights, pens, canes, socks full of coins, small utility knives, and many others.
Modern armies still train in the use of hand-to-hand combat, including bayonet usage. Being able to fight effectively in situations where your primary weapon is inoperable or impractical is a useful ability, though the training is usually considered more for building confidence, aggression, and physical conditioning.