Antonio Henrique do Nascimento, 16, had never cared much for school and spent most of his time peddling drugs in the dingy alleys of one of Rio's crime-ridden, hillside shanty towns (favelas).
But he recently discarded weapons in favour of a PC, and has returned to school in the hope that it will help him understand computing manuals.
"I'm a better person armed with computer skills," said the teenager, who now hopes to vent his gripes about the injustices of life on the Internet. "I've even gone back to school because I can see a purpose in learning something."
After school in the mornings, he returns to the Morro dos Macacos slum, where for the past months the community has run a small IT school, kitted out with 14 top-line Pentiums.
He is among thousands of youths to find an alternative to a life of crime via 57 computing schools set up in as many favelas across Rio by a young Brazilian teacher.
Antonio "came off the streets" to attend daily classes in different computer programmes, eager to master skills which he sees as gifts for a better future.
So far, more than 7,000 pupils have had the benefit of a four-month computing course for a small fee.
The project was dreamed up by a computer science teacher Rodrigo Baggio in 1993. "I thought that if there was one way to bridge the gap between rich and poor, it would be by getting technology into the slums," said Baggio, who gave up his job to lobby companies in Brazil and worldwide to donate computers for the slums.
This month, he received $14 million (pound;8.75m) worth of software from Microsoft and $100,000 in cash to further his already successful programme.
Baggio's project has also been commended as a model programme by UNESCO, the education arm of the United Nations, and has become the blueprint for similar schemes in South Africa, Mexico, India, Zambia and Zimbabwe.
The organisation he founded, the Committee for the Democratisation of Computer Technology (CDI), set up its first school in 1995 in the Dona Marta favela, a cluster of 30,000 brick and corrugated-iron shacks which overlooks Rio's famous Sugar Loaf mountain.
Relying on donations of top-line Pentiums and dozens of voluntary workers, the CDI set up new schools by identifying suitable rooms or buildings in the shanties, choosing an already established community organisation to work with, and training locals to become the future instructors.
"Brazilian society has traditionally kept its poor away from technology, but the poorer people know that via IT they have a better chance of rising above inequality," said Leandro Farias, aged 18, Antonio's computing teacher in Morro dos Macacos.
He was a student himself until only a few months ago and, trained by the CDI, he now runs daily classes for more than 200 teenagers.
"At school, we will never have a chance to surf the Web," said one 11-year-old. "But here at the computer school I can, and I can learn like the rich boys in the posh areas," he added.