Creating a border using ncurses The biggest question is if it's worth it to use a useless if statement to make the x and y variables local away from the main statement.

    //Unconventional part, make it so that x and y are local variables
if(true){
        int x,y;
        //set x and y to be the width + height of the terminal
        getmaxyx(stdscr,y,x);
        for(int i = 0; i &lt; x; i++){
                //top border
                mvaddch(0,i,'#');
                //bottom border
                mvaddch(y - 1,i,'#');
        }
        for(int i = 0; i &lt; y; i++){
                //left border
                mvaddch(i,0,'#');
                //right border
                mvaddch(i,x - 1,'#');
        }
}
You can create a block without an if statement.
For example, these are equivalent:

{
    // some code
}

if (true) {
    // some code
}


But it's not a good practice to create blocks like this.
It's a code smell,
suggesting to wrap // some code in a dedicated function instead.

Anytime you think some neat trick is "unconventional",
it's most probably a bad practice. Don't do it, fix it.