• 1 Post
  • 258 Comments
Joined 3 years ago
cake
Cake day: July 23rd, 2023

help-circle




  • 404@lemmy.ziptoTechnologyMulti-cursor code editing: An animated introduction
    link
    fedilink
    English
    arrow-up
    2
    arrow-down
    2
    ·
    edit-2
    19 days ago

    Or just use an editor built on this concept, like Helix.

    Edit: Okay. I got downvoted and I see why. Let me rephrase:

    If you are interested in this editing mode, you should check out editors that are built around this concept, like Helix (and certain vim/neovim configs/plugins). Having native integration makes it insanely powerful (and you don’t have to get Emacs pinky from all the modifier presses).













  • 404@lemmy.ziptoProgrammer Humor@programming.devTOML
    link
    fedilink
    English
    arrow-up
    8
    ·
    edit-2
    2 months ago

    For programming languages that make use of {}, the reason is (almost always) scope.

    Take for instance this:

    for i in 0..10
    do_thing();
    do_other_thing();
    

    compared to this:

    for i in 0..10 {
        do_thing();
    }
    do_other_thing();
    

    The intent of the first one is unclear. In the second one it’s clear you should loop do_thing() and then run do_other_thing() afterwards. The indentation is only for readability in the above though. Logically there would be no difference in writing

    for i in 0..10 { do_thing(); } do_other_thing();
    

    Languages that use indentation and line breaks for scope look more similar to this:

    for i in 0..10:
        do_thing()
    do_other_thing()