DEV Community

Beatriz da Silva
Beatriz da Silva

Posted on

1

Dia 3 - #100DaysOfSwift

Operadores de comparação

Servem pra comparar dados num geral, podem ser usado pra dados numéricos, texto, etc.

Image description


Operador ternário

É muito útil pra quando se quer fazer algo específico se algo for verdadeiro ou falso de forma bem mais enxuta do que usando um if/else.

Image description

Nesse exemplo o valor resultante do ternário é atribuído à variável z:

Image description


Switch

Se tiver que fazer várias condicionais usando um mesmo valor como parâmetro, fica mais fácil usar um switch do que um if/else.

Caso queira que mesmo após cair num case ele também execute o próximo é só colocar a keyword fallthrough.

Image description


Operadores de range

No swift existem duas formas de representar um range.
..< exclui o último número do range:

Image description

... inclui todos os números que estão no range.

Image description

Image of Timescale

🚀 pgai Vectorizer: SQLAlchemy and LiteLLM Make Vector Search Simple

We built pgai Vectorizer to simplify embedding management for AI applications—without needing a separate database or complex infrastructure. Since launch, developers have created over 3,000 vectorizers on Timescale Cloud, with many more self-hosted.

Read full post →

Top comments (0)

Billboard image

📊 A side-by-side product comparison between Sentry and Crashlytics

A free guide pointing out the differences between Sentry and Crashlytics, that’s it. See which is best for your mobile crash reporting needs.

See Comparison

👋 Kindness is contagious

Dive into an ocean of knowledge with this thought-provoking post, revered deeply within the supportive DEV Community. Developers of all levels are welcome to join and enhance our collective intelligence.

Saying a simple "thank you" can brighten someone's day. Share your gratitude in the comments below!

On DEV, sharing ideas eases our path and fortifies our community connections. Found this helpful? Sending a quick thanks to the author can be profoundly valued.

Okay