Significant investment in school buildings has reaped rewards, with almost 100,000 more students learning in "good" surroundings than five years ago. But three-quarters of young people still attend schools that fail to reach that standard, figures reveal.
This year, there are 241,392 students at 623 state schools in "good" condition - the highest rating - compared with 144,918 students at 404 schools in 2008. In the same period, the number of schools rated "bad", the worst ranking, dropped from 134 to 17, and the number of students attending them from 175,354 to 103,815.
But much work remains to be done, with only 24 per cent of schools qualifying as good. Most of the 2,566 schools rated were "satisfactory" (58 per cent), while 17 per cent were "poor" and less than 1 per cent "bad".
The figures were part of national school statistics published by the Scottish government (bit.lyScotStats).
Scotland's Schools for the Future programme was launched in 2010. By 2018, when it is due to finish, pound;1.25 billion will have been spent on 67 new schools. So far, 13 schools have been completed at a cost of pound;180 million. Various other national and local initiatives have also contributed to the improvement in standards.
"There has been significant investment in the school estate in recent years, and this is reflected in the number of pupils now being educated in good-quality classrooms," said Larry Flanagan, general secretary of the EIS teaching union.
"There is still a considerable amount of work to be done to bring all schools up to standard after decades of underinvestment," he added. "But these are encouraging statistics that highlight the progress that is being made on providing an appropriate environment for learning and teaching in schools across Scotland."
Eileen Prior, executive director of the Scottish Parent Teacher Council (SPTC), said there was a "huge amount of benefit" from teaching in good- quality school buildings. "We would say, however, that the quality of the teaching and the level of engagement from parents are even more important," she added.
The SPTC's only concern was over an issue raised in an exclusive TESS report, which showed that while Scottish schools often had outstanding facilities, many were seldom used by communities outside school hours ("Is it the winner's cup or wooden spoon for school sports facilities?", News focus, 16 August).
"Our view is that these are community assets, which should be available to the community," Ms Prior said.
Ken Cunningham, general secretary of School Leaders Scotland, said: "The more recent buildings have been particularly good because people have learned from some of the earlier examples and have worked more with the schools themselves, involving young people, staff and parents where possible.
"A spacious, well-lit and multipurpose building certainly enhances the experience of young people, but it still takes the concerted effort of staff and pupils to make it really work."
Education secretary Michael Russell said the latest figures showed that 84 per cent of students were in good or satisfactory buildings in April this year. Schools such as the "incredible" new Eastwood High in East Renfrewshire were bright, spacious and "truly state of the art", he said.
"We know that Scottish education is good but we want to make it even better," Mr Russell added. "New buildings, good teachers and a conducive learning environment are the pillars on which Curriculum for Excellence stands."
But Labour education spokeswoman Kezia Dugdale said the Scottish government "should not be too self-congratulatory". She pointed to an increase since 2012 in the number of children in school buildings identified as poor, and an increase since 2010 in the number of children in bad buildings.
"We know, too, that teachers are working under greater pressure than ever to deliver a new curriculum and exams," Ms Dugdale added. "The potential of new school buildings can only be delivered when what happens inside them is working well."
Conservative education and lifelong learning spokeswoman Mary Scanlon said the figures, and the investment behind them, were "very welcome". But she stressed that many schools that did not rate badly overall still had poor heating and ventilation.
The annual statistics round-up also prompted the EIS to criticise the Scottish government for "broken promises" after figures showed a rise in average P1-3 class sizes and a fall in the number of preschool children with access to a teacher.