Can I put an assert statement inside of a task?

Did some digging and found this other post, so I guess the answer is no you cannot have an assertion here.

https://verificationacademy.com/forums/systemverilog/can-we-use-system-verilog-properties/assertions-inside-class