NEWARK — When comedian Artie Lange left the courtroom last Friday with a four-year probation sentence he knew it could have just as easily meant prison. What happens now is up to him.

Lange, who has battled substance abuse issues for years, credited Judge Nancy Sivilli for giving him another chance, but also took to social media to see his life now as a cautionary tale.

"If I end up in jail for years let my life be a lesson to you kids battling Heroin," he said on Twitter Saturday. "I had everything! and more. I traded it for powder. Don't make that mistake. Ur better than that. & I love you!!"

The comedian's sentence came after pleading guilty last year to heroin possession. Before he was sentenced, Lange called himself a "scumbag" on Twitter, and said that if he was sent to jail it could have a negative affect on people beyond himself.

"I've been a good boy and juggled work w recovery," he said. "I've been my mom's only source of income for 30 years."

He said at the time that he would take whatever sentence he received "like a man."

In addition to probation, Lange was also ordered to enter an outpatient rehab program so he could get treatment while also continuing to work, according to NJ.com. Prosecutors had argued that he should be treated at an inpatient facility, calling Lange "his own worst enemy."

At his hearing last week, Sivilli pointed to his medical records as being enough reason for Lange to stay clean, according to NJ.com. The website said she cited a note from his doctor saying he could die if he relapses again.

Lange is currently a member of the cast for HBO's "Crashing" and has made a name for himself on the stand up comedy circuit as well as on "Mad TV" and the "Howard Stern Show."

Over the past few years Lange has made several appearances on New Jersey 101.5 with both Dennis and Judi and Steve Trevilese. During a call into Trevilese's show in March where he discussed some of his recent issues, and invited Trevilese to open for him at a New Jersey show.