Introduction: Coding is increasingly recognized as an effective pedagogical approach for developing computational thinking, problem-solving, and creativity, which are considered essential 21st-century skills within STEM education. Recent studies suggest that coding activities can foster divergent thinking by engaging students in structured yet flexible processes of exploration, design, and solution generation. This study investigates the impact of coding-based educational interventions on the development of creative thinking in primary and secondary school contexts.
Methods: The research adopted a quasi-experimental design involving experimental and control classes in primary and secondary schools. Experimental groups participated in structured coding activities integrated into school projects, while control groups followed regular curricular activities. Creativity was assessed through the Divergent Association Task (DAT), administered before and after the intervention to measure verbal divergent thinking. The sample included 138 primary school students and 148 secondary school students. Pre- and post-test mean scores were compared to identify changes in creative performance.
Results: In primary school, experimental classes showed a greater increase in creativity scores (+3.27%) compared with control classes (+1.51%). In secondary school, both groups improved, with a slightly higher increase in experimental classes (+2.62%) than control classes (+2.54%). Individual-level analysis showed that a higher percentage of students in experimental groups improved their performance, particularly in primary education.
Conclusions: The findings suggest that coding can contribute to the development of creative thinking, especially in primary school, when embedded in intentional pedagogical designs. The results highlight the relevance of coding as a technology-enhanced educational strategy within STEM learning and suggest that age, instructional design, and teacher mediation may influence its educational effectiveness.