The Influence of Error Learning Orientation on Intrinsic Motivation for Visual Programming in STEM Education

Secondary school students often lack the necessary motivation to program visually. The present study aims to analyse the effects of error learning orientation on students’ intrinsic motivation for visual programming. According to the control-value theory of Pekrun (2006), we posit that the influence of error learning orientation on intrinsic motivation is mediated by self-efficacy for visual programming as well as by errorrelated achievement emotions. A sample of 269 Swiss secondary school students (grades 7 to 9), who were beginners in visual programming, filled out a questionnaire as part of a course on visual programming. A structural equation model was established to illustrate the expected relationships between students’ attitudes and their impacts. As expected, the results point to the need of paying more attention to errors in STEM education and indicate that students’ error learning orientation had a low but significant effect on their intrinsic motivation for visual programming. The findings confirmed the effects of error learning orientation on intrinsic motivation for visual programming, which are mediated by self-efficacy but not by error related achievement emotions in the context of coding activities.


INTRODUCTION
Because programming is included in the curricula of multiple countries, it has been examined in many different ways. Several studies shed light on learning at the student level (e.g., Fanchamps et al., 2021;Cederqvist, 2020), but also on how teachers deal with this rather new subject (e.g., Vinnervik, 2020). Some investigations focus on programming with a specific microcontroller such as the micro:bit (e.g., Cederqvist, 2020), or on specific programming languages (e.g., Portelance et al., 2016). This paper looks at errors as another important aspect of learning a new visual programming language at the student level. With visual programming, errors can often occur, and the students quickly receive feedback as to whether they have programmed correctly or incorrectly. Moreover, visual programming with a microcontroller, such as the micro:bit, allows them to directly see the effects of their errors. Visual programming of a microcontroller therefore offers productive learning opportunities for students to learn from errors. In this context, our paper aims to analyse the possible influence of students' error learning orientation, as a cognitive feature of dealing with errors, on their intrinsic motivation for visual programming. Intrinsic motivation could be considered a central driver of learning, in contrast to extrinsic motivation, which is caused by external incentives or factors. According to self-determination theory, intrinsic motivation is particularly important for persistent and effective learning. Nevertheless, in school, more extrinsic forms, e.g., integrated or identified regulation, can also be regarded as beneficial forms of motivation on the way to more autonomous student learning. An intrinsically motivated student achieves a task due to the inherent satisfaction in completing it, i.e., for fun or to overcome the challenge (Ryan and Deci, 2000). However, in finishing a programming activity, students could make errors, which may possibly affect their intrinsic motivation. When students engage productively with errors, they are supposed to learn (Kreutzmann et al., 2014;Pekrun, 2006). Dealing with them productively creates a sense of competence, as well as being enjoyable and motivating. In contrast, unfavourable feelings of self-esteem caused by the experience of problems with a programming task are associated with more negative emotions, which are a hindrance to intrinsic motivation (Kreutzmann et al., 2014;Pekrun, 2006). Furthermore, if students do not see errors as learning opportunities, either because they are afraid of them or because the teacher puts pressure on the students, they are not likely to deal with them in a learning-enhancing way (Pekrun, 2006;Spychiger et al., 2006).
With respect to these first considerations of the experience of errors as part of secondary school students' learning and their influence on students' intrinsic motivation, the question arises as to how STEM educators could specifically address student's dealing with errors and the influence of errors on learning in STEM (science, technology, engineering and mathematics) education. The question will be discussed here specifically in regard to visual programming languages, as this content is an ideal learning environment for developing a positive error learning orientation.

Dealing with Errors
One outcome of the international comparative study PISA (Programme for International Student Assessment) is the increasing importance of a positive error culture as a criterion for good teaching (Meyer et al., 2006;OECD, 2021). In STEM subjects, varying tasks can be offered in which the students can work with errors in different ways, e.g., by using the trial-and-error method (Bei et al., 2013;Edwards, 2004), the debugging process (Michaeli and Romeike, 2019;Perscheid et al., 2016) or the productive-failure approach (Kapur, 2015). In this context, attention should be focused not only on the tasks themselves, but also on the effects on learning when students encounter errors during the activity. If the experience is positive, dealing with them can increase students' motivation and self-efficacy and generate pleasant emotions (Schumacher, 2008;Schunk and Usher, 2012;Tulis and Ainley, 2011). However, the frustration caused by errors can also lead to an abandonment of the learning activity. Therefore, more importance should be attributed by teachers to how students handle errors as part of the learning process.
Errors in lessons are often defined as "facts or processes that deviate from a norm" (Kobi, 1994, p. 6). Norms can be related to a subject or be social or moral, and must be known by the students (Oser et al., 1999). Errors in class in relation to a subject can be, for example, incorrectly solved tasks or wrongly assessed verbal reports. Social errors include, for instance, disrupting a lesson, and moral ones involve, for example, lying (Kreutzmann et al., 2014). In this study, which has a focus on subject-related errors, they can set important learning processes in motion if students view errors as something they can learn from. Depending on how they are handled, errors can be conducive to learning, but they can also be an obstacle. A distinction must be made between the way teachers and students deal with errors (Spychiger et al., 2006). In order for students to learn from them, both instructors and pupils need to adopt a positive attitude towards the handling of errors (Spychiger et al., 2006). On the part of the teachers, this means that they must be error-friendly. In other words, they should create situations in which errors are allowed to happen, and should react positively to the errors of the students (by being patient and not scolding or shouting). Teachers must also admit their own errors and model how to deal with them in a positive way. In addition, they should always make it clear to the students which norms apply, so that the students are aware when they have deviated from these and consequently have made an error (Spychiger et al., 2006). Although the teacher's approach is also important, the decisive factor as to whether or not students learn from errors is the way in which they deal with them themselves (Kreutzmann et al., 2014;Spychiger et al., 2006). With respect to the topic of this research, this shows that programming is associated with specific opportunities and traps in terms of learning and dealing with errors.
Programming is a part of the curriculum in multiple countries. This rather new subject offers many facets of learning, such as fostering problem-solving skills (e.g., Gülbahar and Kalelioglu, 2014), learning through trial and error (Bei et al., 2013;Edwards, 2004) and grasping a new language (e.g., Portelance et al., 2016). In contrast to other subjects, such as, e.g., languages, in programming, the counterpart is not a human being with emotions, social competences and the ability to interpret, but a technical device, which only understands what has been communicated through visual or text-based programming. This means that communication must be accurate. If there is the slightest error, such as an incorrect block in visual programming or a comma instead of a dot in text-based programming, the technical device does not understand what it has to do. These circumstances inevitably lead to students making errors. However, this also opens up great potential for learning from them. Coding lessons in STEM education offer ideal conditions for establishing a positive error culture in the classroom, which will be described below. In this study, we focus on the errors secondary school students make using the technical device micro:bit.
First, working with the micro:bit has the advantage that errors are recognized immediately and the students do not have to compare their solution with a sample one or wait for the teacher's feedback. Second, if there is an error while working with the micro:bit, either nothing happens or the micro:bit does not carry out the desired action. This means that the students must look for the cause of the problem. In doing so, they can exchange ideas with their classmates and discover other solutions. At times, the students are not able help themselves. In this case, they can apply the "trial-and-error" method, as has been described by, amongst others, Edwards (2004). This is a learning method that, for security reasons, cannot really be applied in other school contexts, such as, for example, in physics when working with electricity or in chemistry when working with chemicals. As part of this method, students work, as the name suggests, by trial and error. Hence, they try something out, change an element in the code and observe what happens. Through this process, students identify steps that lead to the end goal, but also include actions that are not successful (Bei et al., 2013;Edwards, 2004).
Furthermore, in digital-based learning settings, whether classical programming lessons or those in which scientific problems are solved with the help of programming, debugging tasks can be provided for students who perceive errors as learning opportunities. Incorrect solutions are provided, which are then improved or debugged by the students (Michaeli and Romeike, 2019;Perscheid et al., 2016). To correct the errors, students can use their knowledge, as well as the "trial-and-error" method, to solve the problems. In such cases, pedagogical methods including cooperative thinking and learning support a positive experience of handling errors.
Programming offers possibilities for teachers to create tasks and environments that allow students to understand errors as opportunities to learn and in which they could experience emotions that should increase their motivation for learning programming. In the following section we will outline, based on the "Control-Value Theory of Achievement Emotions" (CVTAE) of Pekrun (2006), how errors as part of learning are connected to students' attitudes, affects and motivation.

Intrinsic Motivation, Self-Efficacy, and Emotions in Dealing with Errors
The "Control-Value Theory of Achievement Emotions" (CVTAE) of Pekrun (2006) (see Figure 1) describes the emotional processes that might occur during learning. This is focused on the influences on and effects of emotions (Pekrun, 2006). According to the CVTAE, achievement goals and beliefs predict the control and value appraisals, which, in turn, predict emotional reactions. Furthermore, emotions, e.g., error-related achievement ones, are deemed to be antecedents of the motivation to learn.
Not all aspects of the model can be investigated in this study. The focus will be on the impact of the error learning orientation as a part of achievement goals and beliefs on the intrinsic motivation for visual programming and the mediating effects of self-efficacy for visual programming and error-related achievement emotions.
As described above, dealing with errors, specifically error learning orientation as the cognitive feature, can be located as an element of achievement goals and beliefs. According to the CVTAE, error learning orientation is assumed to have an influence on intrinsic motivation for visual programming. This statement can be supported by Schumacher (2008), who states that the successful overcoming of errors leads to a greater intrinsic motivation to learn. He further states that intrinsically motivated students are less likely to be dissuaded from learning if they fail. In this study, we focus on the experienced level of intrinsic motivation for visual programming.
Furthermore, and according to CVTAE, error learning orientation affects self-efficacy as a part of control expectancy. This statement is also supported by Kreutzmann et al. (2014) and Schunk and Usher (2012), who proved that error learning orientation was predictive of self-efficacy. According to Schunk and Usher (2012), successes like correctly solved tasks can increase students' self-efficacy, while errors can decrease it. Students with a high level of self-efficacy are more likely to set higher goals, persevere even in the face of failure and regain their sense of efficacy after making an error, as well as to report more positive emotions. Students with low self-efficacy set themselves low objectives and are more likely to give up when they make errors and subsequently undergo negative emotions. However, errors do not always have to be associated with low self-efficacy (Schunk and Usher, 2012). As self-efficacy is topic-specific, we focus on a particular type, the self-efficacy for visual programming with Microsoft MakeCode for micro:bit.
Error-related achievement emotions can be associated with achievement emotions. According to Pekrun et al. (2006), positive attitudes towards errors can facilitate positive emotions and reduce negative ones. Hence, a constructive error learning orientation should facilitate positive emotions and reduce negative ones. Tulis and Ainley (2011) were able to show that not all students always experience negative emotions after making an error. In their study of 182 fifth grade students, 46% of the students surveyed reported experiencing no emotions following making an error, 33% anger and boredom, 5% anxiety and despondency (sadness, shame, fear) and 16% positive emotions. These included interest, joy and pride. A comparison of students reporting negative emotions after making an error with those experiencing pleasant ones showed that more positive attitudes towards making errors and mastery orientation correlated. These results corroborate the findings of Diener and Dweck (1980) and Dweck and Leggett (1988), namely, that certain students reported positive emotions after making an error, others reported anger and boredom, and a third group reported inward-looking emotions, such as anxiety, shame and sadness. Furthermore, according to the CVTAE, emotions have an impact on one's motivation to learn.
In addition, research has shown that in STEM subjects, there are gender differences in learning motivation (e.g., Oppermann et al., 2020) and self-efficacy (e.g., Kessels, 2012). As expected, these results are also reflected specifically for programming (e.g., Funke et al., 2015). Boys seem to be more motivated to program compared to girls (Adleberg, 2013).
Furthermore, boys seem to have higher self-efficacy using a computer (Cassidy and Eachus, 2002) and also feel more able to program compared to girls (Gunbatar and Karalar, 2018). With regard to the emotions experienced after making an error, Dresel et al. (2013) were able to show that boys report a higher affective-motivational adaptivity of error reactions in mathematics than girls. It is therefore inferred that boys will also report more positive emotions after an error in programming than girls. In contrast, Arndt (2020) was able to show that girls have a higher error learning orientation than boys.
Intrinsic motivation seems to dwindle over the school years. However, this also depends on the type of subject, with maths showing the greatest decline over time (Gottfried et al., 2001). It is assumed that younger students have a higher intrinsic motivation for programming than older ones. A similar assertion can be made for self-efficacy. In terms of computer self-efficacy, Simsek (2011) showed that elementary students were more self-efficient than secondary ones. It is assumed that younger students also have a higher self-efficacy in programming than older ones. Furthermore, Hascher and Hagenauer (2010) were able to show that the older the students become, the less they experience errors as emotionally stressful. Wang et al. (2019) could not find a correlation between error learning orientation and age in their study, in which a positive error learning orientation led to learning from errors and negative emotions moderated this effect. It should be noted, however, that their investigation surveyed adults aged 20-56. By grounding our analysis in the CVTAE, we gain a theoretical framework for embedding the aforementioned four scales, namely, error learning orientation, intrinsic motivation for visual programming, self-efficacy for visual programming and error-related achievement emotions, that we aim to explore and relate to each other in our study.

RESEARCH QUESTION AND DESIGN
We propose that students' error learning orientation is related to their intrinsic motivation, self-efficacy, and emotions through direct or moderated effects. These postulated relationships are relevant for understanding and supporting students' handling of errors in visual programming. The focus is on the following question: To what extent does error learning orientation have an effect on students' intrinsic motivation for visual programming?
Specifically, we postulate that: 1a) error learning orientation has a positive effect on a student's intrinsic motivation for visual programming. 2a) error learning orientation with regard to intrinsic motivation is mediated by self-efficacy for visual programming. 2b) error learning orientation with respect to intrinsic motivation is mediated by error-related achievement emotions.

Research Design
To answer the research question, we applied a quantitative cross-sectional model. The students were questioned at the beginning of a programming activity at the out-of-school STEM lab Smartfeld (www.smartfeld.ch).

Sample
The sample consisted of 269 Swiss secondary school students (grades 7 to 9) from the eastern region of Switzerland. The age range was between 12 and 16 years. The mean age was 13.6 and the majority of the students were in grade eight. All students were classified by the teachers as beginners in visual programming, with little prior knowledge. Consent to participate in the study was obtained through the respective teacher. By participating in the course, the teacher confirmed that the students would take part in the survey. The questionnaires were completely anonymous.

Instruments
The students' questionnaire consisted of four scales, with reference to error learning orientation, error-related achievement emotions, specific self-efficacy and intrinsic motivation for visual programming ( Table 1). In addition, the students' gender and age were obtained. All items used in the four scales were adapted from the literature. As we focus on the students' individual handling of errors, the "error learning orientation" scale by Spychiger et al. (2006) was selected and adjusted for this paper. This scale includes the cognitive feature of dealing with errors at an individual level. The items refer to attitudinal, achievement motivational and reflective aspects with regard to behaviour after making an error (Spychiger et al., 2006). The "error learning orientation" scale contained five items.
To measure the emotions students experience after making an error, the "affective-motivational adaptivity" scale developed by Dresel et al. (2013) was chosen and adapted for the questionnaire. This scale "refers to the maintenance of learning enjoyment and motivation as well as the regulation of negative emotions and associated motivation-relevant cognitions (e.g. task-irrelevant thoughts, self-doubt)" (Dresel et al., 2013). The final scale was renamed according to the CVTAE to refer to error-related achievement emotions and consisted of six items.
The "self-efficacy for visual programming" scale in our study, with Microsoft MakeCode for micro:bit, was adapted from Güdel (2014) and included six items.
The last scale, which concerned the intrinsic motivation for visual programming with Microsoft MakeCode for micro:bit, was modified from the interest/enjoyment subscale of the Intrinsic Motivation Inventory (IMI). As described in the article, this subscale elicits students' intrinsic motivation (Center for Self-Determination Theory, n.d.). The scale for "intrinsic motivation for visual programming" with Microsoft MakeCode for micro:bit was also composed of six items.
In addition to the four scales, the students' age and gender were included in the questionnaire.
As the questionnaire was used in German-speaking Switzerland, all items were formulated in German. The items were translated into English for this paper and can be found in Appendix A.

Data Analyses
Statistical analyses of the data were conducted with SPSS for descriptive analysis and correlations. MPlus 7 was used for the computation of structural equation models (SEM) in order to investigate the relationships of the research model (see Figure 1).
The model fit was evaluated according to the following criteria: the chi-square test of model fit, root mean square error of approximation (RMSEA), comparative fit index (CFI) and the Tucker-Lewis index (TLI). The following values were considered a good fit between the hypothesized model and the observed data: RMSEA values ≤ .06, CFI and TLI values ≥ .95, whereas RMSEA values ≤ .08, CFI and TLI values ≥ .90 indicated an acceptable fit (Hu and Bentler, 1999;McDonald and Ho, 2002).

RESULTS
Generally, the students' error learning orientation and error-related achievement emotions, and the intrinsic motivation for visual programming, were somewhat positive, with rather high standard deviations for self-efficacy and intrinsic motivation. The students' self-efficacy for visual programming was exactly in the middle of the scale. Therefore, the mean value was neither positive nor negative. In addition, self-efficacy had a rather high standard deviation. The mean age of the students was 13.6, with a standard deviation of 1.04. The sample was almost equally distributed in terms of gender, with a slightly larger number of male students ( Table 2). .50 Note: Six-point Likert scale used in the questionnaire (1 = completely false, 2 = mostly false, 3 = somewhat false, 4 = somewhat true, 5 = mostly true, 6 = completely true); gender: female=0, male=1.
To show the impact of error learning orientation and the mediation effect of self-efficacy and error-related achievement emotions on intrinsic motivation, several structural equation models, in line with the research model, were tested and compared. The SEM was estimated with aggregated manifest variable indicators (the means calculated from parcels of items) to reduce the number of parameters calculated in the complex models, owing to the sample size. In a further step, age and gender were included as control variables for all four scales. The final model showed the following good fit values: χ 2 = 5.05, df (degrees of freedom) = 2, p = 0.08, RMSEA = 0.075, CFI = 0.99 and TLI = 0.94 (see Figure 2).
As outlined in Figure 2, significant direct and indirect paths were observed to explain a student's intrinsic motivation for visual programming. The total effect of error learning orientation on intrinsic motivation is significant (beta = .370, p = .000). The main direct path is between error learning orientation and the intrinsic motivation for visual programming (thick path). This path showed a small but significant effect (beta = 0.156, p = 0.002) of error learning orientation on intrinsic motivation.
Although the paths from error learning orientation to error-related achievement emotions and from emotions to intrinsic motivation both show substantial beta values, there was only a small indirect effect of error learning orientation on intrinsic motivation for visual programming via error-related achievement emotions (dashed path, beta = 0.048, p = 0.033). Hence, error-related achievement emotions do not act as a mediator between error learning orientation and intrinsic motivation.
Furthermore, there was an indirect effect of error learning orientation on the intrinsic motivation for visual programming via self-efficacy (dotted path, beta = 0.159, p = 0.000). Self-efficacy for visual programming acts as a mediator between error learning orientation and intrinsic motivation for visual programming. This higher selfefficacy led to a positive impact on intrinsic motivation. However, when error-related achievement emotions are included as well, then the indirect effect of error learning orientation on intrinsic motivation mediated by selfefficacy and error related-achievement emotions become insignificant, meaning there is no longer any indirect influence (beta = 0.006, p = 0.092) (see also Figure 2).
The model explained 53% of the students' variance in intrinsic motivation, 32% of the students' variance in self-efficacy, and 32% of students' variance in error-related achievement emotions.
Furthermore, we notice that gender has a high positive effect on self-efficacy and intrinsic motivation, and a low positive effect on error-related achievement emotions. Boys have higher self-efficacy and intrinsic motivation for visual programming, and they experienced more pleasant emotions after making an error than girls. Age has a negative effect on self-efficacy and intrinsic motivation, and a positive one on error learning orientation. Younger students have a higher self-efficacy and greater intrinsic motivation for visual programming, but older ones perceive errors more as learning opportunities than younger students. Finally, gender has no effect on error learning orientation and age has no impact on error-related achievement emotions. Male and female students have a similar error learning orientation and those at different ages have similar error-related achievement emotions.

DISCUSSION AND CONCLUSION
The research question was to what extent error learning orientation has an effect on students' intrinsic motivation for visual programming. According to the CVTAE a positive effect of secondary school students error learning orientation on their intrinsic motivation for visual programming was proposed (hypothesis 1a). Furthermore, it was assumed that error learning orientation with regard to intrinsic motivation is mediated by selfefficacy for visual programming (hypothesis 2a) and by error-related achievement emotions (hypothesis 2b). The students selected were all beginners in visual programming. Hence, these students had little background with the subject. In this context, they brought along the experience of numerous errors from their first attempts.
In our study we confirmed hypothesis 1a that error learning orientation has a small but significant effect on students' intrinsic motivation for visual programming. This means that when students perceive errors as learning opportunities, they also seem to possess a high intrinsic motivation for visual programming. The results clarified that in addition to students' behaviour regarding errors, namely, the successful overcoming of errors (Schumacher, 2008), students' positive attitudes towards errors, that is, error learning orientation, fosters the intrinsic motivation to learn. The results showed that error learning orientation is important to explain differences in students' intrinsic motivation for visual programming. The fact that motivation is influenced by other factors, such as teacher performance, could explain the remaining variance (Tambunan et al., 2021), in addition to teaching strategies (Bomia et al., 1997) and classroom climate (Starr et al., 2020), as well as parental advice (Fan and Williams, 2009).
The results also confirmed hypothesis 2a that error learning orientation with regard to intrinsic motivation is mediated by self-efficacy for visual programming. The outcome indicates that the relationship between error learning orientation and intrinsic motivation is complex. It showed that positive error learning orientation increases self-efficacy, which, in turn, has a positive effect on intrinsic motivation. Kreutzmann et al. (2014) and Schunk and Usher (2012) support the findings that error learning orientation has a positive impact on self-efficacy. Research by Ryan and Deci (2000) and Krapp and Ryan (2002) further underlined that self-efficacy has an important influence on intrinsic motivation.
The findings could not confirm hypothesis 2b that error learning orientation with regard to intrinsic motivation is mediated by error-related achievement emotions. The effects of error-related achievement emotions, as the beta effect (0.048) was very low. This shows that error-related achievement emotions do not seem to play an important role in students' intrinsic motivation to work on coding problems. According to Pekrun's (2006) CVTAE, however, error-related achievement emotions were expected to have an impact on intrinsic motivation.
In our study, boys had higher self-efficacy and intrinsic motivation for visual programming and they experienced more pleasant emotions after making an error than girls. These results are in accordance with the findings of previous research (Adleberg, 2013;Dresel et al., 2013;Gunbatar and Karalar, 2018).
Age has a negative effect on self-efficacy and intrinsic motivation, and a positive effect on error learning orientation. This means that younger students have a higher self-efficacy and a higher intrinsic motivation for visual programming, but older learners perceive errors as learning opportunities more than younger ones. The findings that younger students have higher self-efficacy and greater intrinsic motivation are consistent with previous research (Gottfried et al., 2001;Simsek, 2011). However, no correlation between error learning orientation and age has been found in previous investigations (Wang et al., 2019). Our discovery that older students have a higher error learning orientation is desirable, as they should become more autonomous learners as they progress through school. Finally, gender has no effect in our study on error learning orientation and age has no impact on error-related achievement emotions. This means that male and female students have a similar error learning orientation and those at different ages have similar error-related achievement emotions. These results are also not in accordance with the literature. Arndt (2020) has shown that girls have a higher error learning orientation than boys and Hascher and Hagenauer (2010) were able to show that the older the students become, the less they experience errors as emotionally stressful.
However, there are some limitations to our research. Firstly, due to Covid-19 and the cancelling of in-service teacher courses at the above-mentioned science centre Smartfeld, only a small sample of 269 Swiss secondary school students participated in our survey. Therefore, it is necessary to clarify whether other studies dealing with errors in the classroom reported similar or different results. In addition, in the present investigation, we had a sample of beginners in visual programming. It would be worthwhile repeating this analysis with more experienced students, who would have already programmed several times. Would this produce similar or different results?
Whereas from a socio-historical perspective the focus of a teacher would have been primarily on avoiding errors in the students' learning process, a contemporary, authentic science lesson should acknowledge the producing of errors while working on tasks and a teacher should use errors for learning purposes. As long ago as 1986, Fisher and Lipson, in their contribution "Twenty questions about student errors", highlighted the importance of taking into account the question of errors as part of the learning process of science. They, therefore, focused on the cognitive aspect of knowledge processing. However, they also posed a question in regard to "how motivation and other mental/emotional states (might) influence learning" (Fisher and Lipson, 1986, p. 798). Since the publication of this work, the handling of errors has received attention in various other theoretical and empirical works. Consequently, it is not a new idea that errors should be used as learning opportunities. However, not enough attention has yet been paid to errors in STEM educational research. To enhance students' ability to view errors as learning opportunities, teachers and students need to create a classroom atmosphere in which errors are handled in a way that promotes learning (Spychiger et al., 2006). This means, among other things, that the norms must be known and the teachers must be error-friendly (Spychiger et al., 2006). In addition, tasks should regularly be set in which the students recognize the learning potential of the error. This includes, for example, activities that give students direct feedback on whether they have done something correctly or not, or tasks or assignments that they can solve using the productive-failure approach (Kapur, 2015) or the "trial-and-error" method (Bei et al., 2013;Edwards, 2004). Furthermore, students should not be afraid of making errors and should see errors as learning opportunities (Spychiger et al., 2006).
Visual coding lessons offer optimal conditions for furthering a positive error culture in the classroom and for letting students perceive errors as learning opportunities and not as failures. Compared to school subjects like mathematics or physics, coding lessons enable students to see or experience errors instantly, without having to wait for the teacher's feedback. Furthermore, students can work with the "trial-and-error" method without the risk of being blamed for making errors or not knowing the answer immediately. As a final point, teachers can provide students with prepared tasks aimed to promote learning from errors, namely debugging tasks, whereby students have to find and correct the problem. All these aforementioned aspects clarify why visual coding lessons are very useful in creating a supportive classroom environment in terms of handling errors.
The findings of this study showed that more attention should be paid to error learning orientation as a cognitive component in dealing with errors to foster students' intrinsic motivation. In addition, students' self-efficacy needs to be considered when dealing with errors in the (STEM) classroom. Self-efficacy mediates error learning orientation and intrinsic motivation. Unexpectedly, no mediation effect of emotions could be proven. Our results complement the existing research with respect to the handling of errors in the classroom as it has been analysed in relation to the specific area of visual programming with Microsoft MakeCode for micro:bit.
In this context, further research could investigate other aspects of dealing with errors and their effect on intrinsic motivation. So instead of error-related achievement emotions, only the fear of error could be considered. The scale assessing the fear of errors developed by Spychiger et al. (2006) could be used for this purpose. It would also be worthwhile to consider other aspects of the CVTAE, such as, for example, the environment, in order to better understand this complex process of learning from errors and consequently to design and support it in a more optimal way. Finally, additional studies could focus on a longitudinal design to examine changes in the way students deal with errors.