Block (programming)

In early languages such as Fortran IV and BASIC, there were no statement blocks or control structures other than simple forms of loops.The above source code can be made even clearer by taking the inner if statement out of the outer one altogether, placing the two blocks one after the other to be executed consecutively.Semantically there is little difference in this case, and the use of block structure, supported by indenting for readability, makes it easy for the programmer to refactor the code.For instance, an integer variable called IEMPNO might be used in one part of a Fortran subroutine to denote an employee social security number (ssn), but during maintenance work on the same subroutine, a programmer might accidentally use the same variable, IEMPNO, for a different purpose, and this could result in a bug that was difficult to trace.In practice, considerations of clarity would probably lead the programmer to choose distinct variable names, but they have the choice and it is more difficult to introduce a bug inadvertently.
Block programmingVisual programming languagecomputer programmingsource codedeclarationsstatementsprogramming languagenestedstructured programmingcontrol structuresscopesmaskedobjectautocodesAlgol 58Algol 60control flowblock scopeALGOL 68batch languageindentationPythons-expressionsEdsger W. Dijkstranested functionsFortran IVPascalconditionalSchemeBasic blockClosure (computer programming)Perlis, A. J.Backus, J. W.Bauer, F. L.Rutishauser, H.Vauquois, B.Naur, PeterProgramming paradigmsComparison by languageImperativeStructuredJackson structuresModularNon-structuredProceduralProgramming in the large and in the smallDesign by contractInvariant-basedNested functionObject-orientedcomparisonClass-basedPrototype-basedObject-basedImmutable objectPersistentUniform Function Call SyntaxDeclarativeFunctionalRecursiveAnonymous functionPartial applicationHigher-orderPurely functionalStrictDependent typesFunctional logicPoint-free styleExpression-orientedApplicativeConcatenativeFunction-levelValue-levelDataflowFlow-basedReactiveFunctional reactiveSignalsStreamsSynchronousAbductive logicAnswer setConstraintConstraint logicInductive logicNondeterministicOntologyProbabilistic logicAlgebraic modelingAutomata-basedActionCommandSpacecraftDifferentiableEnd-userGrammar-orientedInterface descriptionLanguage-orientedList comprehensionLow-codeModelingNatural languageNon-English-basedPage descriptionfiltersProbabilisticQuantumScientificScriptingSet-theoreticSimulationStack-basedSystemTactileTemplatingTransformationGraph rewritingProductionPatternVisualConcurrentdistributedparallelActor-basedAutomatic mutual exclusionChoreographic programmingConcurrent logicConcurrent constraint logicConcurrent OOMacroprogrammingMultitier programmingOrganic computingParallel programming modelsPartitioned global address spaceProcess-orientedRelativistic programmingService-orientedStructured concurrencyMetaprogrammingAttribute-orientedAutomaticInductiveDynamicExtensibleGenericHomoiconicityInteractiveHygienicMetalinguistic abstractionMulti-stageProgram synthesisBayesianInferentialby demonstrationby exampleReflectiveSelf-modifying codeSymbolicTemplateSeparationof concernsAspectsComponentsData-drivenData-orientedEvent-drivenFeaturesIntentionalLiterateSubjects