this post was submitted on 27 Jan 2025
261 points (95.2% liked)

Comic Strips

13476 readers
3370 users here now

Comic Strips is a community for those who love comic stories.

The rules are simple:

Web of links

founded 2 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] stupidcasey@lemmy.world 22 points 4 days ago (1 children)

You generally use them at the end of a line but it is more accurate to say you use them at the end of a statement but we usually put each statement on a single line so it is easy to make that mistake example:

Tap for spoiler

<?php
$x = 5; // Semicolon ends the statement
$y = 10; // Another statement ends here

if ($x < $y) { // No semicolon needed here
    echo "x is less than y"; // Semicolon ends this statement
}

$x = $x + $y; // Statement ends here
echo $x; // Outputs 15
?>

[–] technomad@slrpnk.net 2 points 4 days ago

Is this programmer trolling? 🤣🤣🤣